in reply to Database handler shared among forked processes

I'm not an Oracle specialist, but from what I've read on the dbi-users mailing list it seems that what you are trying to do is not supported.

You might get away with setting InactiveDestroy in the children, but you're almost certainly better off with one connection in each child.

This will also avoid problems if two child process try to use the same handle at the same time.

Note that I've been able to use shared handles among child processes with Sybase::CTlib, but then Sybase specifically states that connection handles can be shared across forks.

Michael

  • Comment on Re: Database handler shared among forked processes

Replies are listed 'Best First'.
Re: Re: Database handler shared among forked processes
by marcos (Scribe) on Jun 09, 2002 at 12:53 UTC
    Thank you for your reply. I'm afraid that you are right: I'll have to implement one connection to Oracle in each child. Anyway I'm not very pleased with this solution: connection to database is expensive both in term of resources and time ... and if my daemon starts having lots of requests I will end up having a lot of database connections ...
    Perhaps this is an area where Perl is sort of weak? I don't know, I'm a great fun of Perl :)

    Thank you very much marcos
      You can write your system so that your child processes are persistent.

      You then communicate between the master (that gets the requests) and each of the children through some form of pipe (maybe Unix sockets) and the child processes can then avoid re-connecting for each request.

      The code obviously gets more complicated, but it's certainly feasible.

      Michael