in reply to Apache <Perl> sections survey

For the survey:

As to your note at the end, that you are considering preopening a DBI connection: don't do that. DBI isn't fork-safe in that manner (at best, you'd be able to use the connection in one of your subprocesses). Instead, you should use Apache::DBI, which lets your subprocesses connect once, on the first request, and hold the connection open for future requests. The connections do have to be one per subprocess, though, so no connecting before the fork and inheriting connections... sorry.


------------
:Wq
Not an editor command: Wq

Replies are listed 'Best First'.
Re: Re: Apache <Perl> sections survey
by cees (Curate) on Nov 25, 2003 at 06:38 UTC
    As to your note at the end, that you are considering preopening a DBI connection: don't do that. DBI isn't fork-safe in that manner

    You are absolutely right in your statement about opening DBI connections at startup and leaving them open to be inherited by the child processes. That causes all kinds of problems.

    But it is perfectly safe to open a DBI connection at startup, use it to do some configuration, and then closing it before the fork. I have a feeling that is what bsb was questioning.

    - Cees