For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > March 2005 > db handles with fork()









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author db handles with fork()
Ramprasad A Padmanabhan

2005-03-30, 3:56 pm

Hi,
I am writing a perl application that connect to a database and then
does a fork()
The child completes the process and does a exit(), but the problem is it
closes the database connection which the parent would like to use.

Can I exit the child process without disconnecting the parent dbi handle

Thanks
Ram


----------------------------------------------------------
Netcore Solutions Pvt. Ltd.
Website: http://www.netcore.co.in
Spamtraps: http://cleanmail.netcore.co.in/directory.html
----------------------------------------------------------
Bob Showalter

2005-03-30, 3:56 pm

Rampra A Padmanabhan wrote:
> Hi,
> I am writing a perl application that connect to a database and then
> does a fork()
> The child completes the process and does a exit(), but the problem is
> it closes the database connection which the parent would like to use.
>
> Can I exit the child process without disconnecting the parent dbi
> handle


I would strongly recommend you connect after the fork. Each process needs to
have its own connection.
jk77

2005-03-30, 3:56 pm

I agree with Bob. Why do you want the parent process to handle the
database connection. What is the purpose of the child process after
the fork?

Ramprasad A Padmanabhan

2005-03-30, 3:56 pm


> I would strongly recommend you connect after the fork. Each process needs to
> have its own connection.


Thanks for the reply.
Even I had thought so, probably for efficiency I can use dbi
cached_connect


Ram



----------------------------------------------------------
Netcore Solutions Pvt. Ltd.
Website: http://www.netcore.co.in
Spamtraps: http://cleanmail.netcore.co.in/directory.html
----------------------------------------------------------
Felix Geerinckx

2005-03-31, 3:57 am

On 30/03/2005, Rampra A Padmanabhan wrote:

> I am writing a perl application that connect to a database and then
> does a fork()
> The child completes the process and does a exit(), but the problem is
> it closes the database connection which the parent would like to use.
>
> Can I exit the child process without disconnecting the parent dbi
> handle


Have you read the 'InactiveDestroy' entry in perldoc DBI?

--
felix
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com