kulls has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I want to use the same db handle in the muliple child processes and i have also set
 $dbh->{InactiveDestroy} = 1 but while processing following error message is coming:
DBD::Oracle::st execute failed: ORA-03135: connection lost contact (DB +D ERROR: OCIStmtExecute)

Can you suggest me any reason or changes need to be made?
-Raja

Replies are listed 'Best First'.
Re: connection lost while passing oracle db handler to forked process
by zwon (Abbot) on Nov 04, 2009 at 14:59 UTC

    You can't use one db handle in multiple processes. That would at least require some synchronization between processes, so no two processes use connection to db simultaneously. And if one process closes connection, it will be closed in other processes too, that's probably why you getting this error.

Re: connection lost while passing oracle db handler to forked process
by moritz (Cardinal) on Nov 04, 2009 at 15:29 UTC
Re: connection lost while passing oracle db handler to forked process
by ikegami (Patriarch) on Nov 04, 2009 at 15:53 UTC

    I want to use the same db handle in the muliple child processes

    Why would you want to do such a thing? You'd have to add lots of code to make sure that only one thread uses the connection at any given time. If these are database heavy threads, they'll be constantly blocked, waiting to use the connection.

Re: connection lost while passing oracle db handler to forked process
by pajout (Curate) on Nov 04, 2009 at 17:39 UTC
    Perhaps http://sqlrelay.sourceforge.net/ is what do you need.
Re: connection lost while passing oracle db handler to forked process
by angelos (Initiate) on Nov 06, 2009 at 10:55 UTC
    Never do that, you are in danger of one forked process mangling prepared SQL statements in a sibling.