in reply to Re: Forking and DBD::Oracle
in thread Forking and DBD::Oracle

That's in essence what i'm doing... the clone() creates a new connection. I also tried not using clone and manuallyc reating a new connection and it exhibits the exact same behaviour.

Replies are listed 'Best First'.
Re^3: Forking and DBD::Oracle
by mzedeler (Pilgrim) on Jul 17, 2009 at 10:01 UTC

    So I guess that the reason you try cloning the database handle is to reuse the connection parameters?

    In that case, you can just write a sub that returns a closure which in turn creates a database handle with all the right parameters.

    sub get_dbh_factory { my @config = @_; return sub { return DBI->connect(@config); } } sub somewhere_else { my $dbh_factory = get_dbh_factory( ... ); if(fork == 0) { my $dbh = $dbh_factory->(); ... } else { my $dbh = $dbh_factory->(); ... } }

    Code above is sloppy and just a sketch, but the principle behind should work.