develooper Front page | perl.dbi.users | Postings from July 2006

Re: (Fwd) dbh handle in forked processes

Thread Previous
From:
Alexander Foken
Date:
July 20, 2006 00:21
Subject:
Re: (Fwd) dbh handle in forked processes
Message ID:
44BF2ED0.6030603@foken.de
You may also want to look how Apache::DBI works.

Alexander

On 20.07.2006 09:09, Jonathan Leffler wrote:

> On 7/19/06, Tim Bunce <Tim.Bunce@pobox.com> wrote:
>
>>
>> ----- Forwarded message from Gene Zhang <genzhang@cisco.com> -----
>>
>> I've an issue with programming DBI and could not find a solution in
>> either your DBI slideshow:
>> http://search.cpan.org/src/TIMB/DBI_AdvancedTalk_2004/index.htm
>> or your book <Programming the Perl DBI>;
>> was hoping you could provide some guidance:
>>
>> I have a program that establishes a $dbh, but then forks multiple child
>> processes, all of which use the same $dbh for queries and then terminate
>> (the process).  I'd like to use the same $dbh connection handle for each
>> child process but as soon as one child exits, the handle is lost.
>>
>> Is the best solution to use connect_cached?
>>
>
> No; the best solution is to connect in each child process.  Anything 
> else is
> unreliable.
>
> I'm pretty sure this is covered in 'perldoc DBI' - it certainly should 
> be.
>
>
>


-- 
Alexander Foken
mailto:alexander@foken.de  http://www.foken.de/alexander/


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About