Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: sandesh tattitali <stattitali at paragon-mcs dot com>
Subject: RE: Passing a connection across a fork()
Date: Feb 23 1998 2:18PM

  We had done a similar thing only we used the direct CT Lib calls to
interact with the Sybase SQL Server. Using the same connection will
not work. In our case since we had long running transactions that were
being handled by the child processes , we kept running into errors like
'incomplete result set..' (It was nearly 2 years ago , so I don't
the exact message ). However, we then had to open a new connection in
each of the child processes and after that we had absolutely no
I guess U might have to do the same.


Sandesh S Tattitali 
Paragon Managed Care Systems 
*	Ph : 313-202-3235
*	Fax : 313-202-3203

"If U can spend a totally useless afternoon in a totally useless way, U
have learned to live"

> -----Original Message-----
> From:	Alex Rolfe [SMTP:arolfe@MIT.EDU]
> Sent:	Sunday, February 22, 1998 3:49 PM
> To:
> Subject:	Passing a connection across a fork()
> I'm writing the back end of a web interface to a Sybase database.  I'm
> using middleware which in turn uses the perl module(s) ct_lib to
> connect
> to the database.  In order to
> handle multiple requests simultaneously, I fork off a child process to
> each request and pass it the connection to the database.  In
> otherwords,
> I have multiple processes using the same connection.  Everything works
> fine unless one of the children is killed.  That kills the connections
> to the database for all of the processes.  The problem seems to be
> that
> the child closes the database connection when it dies.  The error
> message that the other children get is to the effect that the database
> connection has been closed.
> My questions are:
> 1) Is is safe to pass a database connection through a fork or am I
> just
> getting lucky?
> 2) How would I disable the connection closing for all but the parent
> process?
> The alternatives are
> - to open a number of database connections and give one to each child
> (though this assumes that passing a connection through a fork is
> allowed)
> - to start multiple daemons on multiple ports and let the front end
> try
> to find a free one.
> Thanks,
>         Alex Rolfe