RE: Handling idle database connections
"Manikantan, Madhunapanthula_Naaga" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.dbi.sybase.devel |
|---|---|
| Message-ID | <1485868F0AD5AC4EB1A9047C9D6FFCE09B776854@MAILNYCMB7A.winmail.deshaw.com> |
Thanks John. This solves the problem of closing idle ones. How do I re-establish a connection on subsequent calls to $dbh? From: John Scoles [mailto:[email protected]] Sent: Saturday, February 02, 2013 11:01 PM To: Manikantan, Madhunapanthula_Naaga; [email protected] Subject: RE: Handling idle database connections you might wan to try visit_handles http://search.cpan.org/~timb/DBI-1.623/DBI.pm#visit_handles and visit_child_handles http://search.cpan.org/~timb/DBI-1.623/DBI.pm#visit_child_handles Send a code ref down the pipe and close the ones that have been idle for a while. Just a though. > From: [email protected]<mailto:[email protected]> > To: [email protected]<mailto:[email protected]> > Subject: FW: Handling idle database connections > Date: Sat, 2 Feb 2013 13:09:03 +0000 > > DBI-dev , can you please take a look and opine? > > Thanks a lot !! > Manikantan > > _____________________________________________ > From: Manikantan, Madhunapanthula_Naaga > Sent: Saturday, January 26, 2013 1:31 AM > To: '[email protected]' > Subject: Handling idle database connections > > > Hello dbi-users, > > I have a ton of PERL scripts that open a database connection, do some database related work for 5 to 10 mts and go on with other work for 2 to 3 days. This means, the database connection will be idle after 5 mts but still exists for 2-3 days. This can potentially choke my server once all the available threads are consumed. I think the right approach is for the developer to disconnect once he is done with database work. Since I have no control over the scripts, I want to explore the below. > > I was wondering if there is any option to DBI that will say " if the connection is idle for say 'X' mts disconnect automatically and set state accordingly. On subsequent call to $dbh it can check the state and re-establish connection as necessary". > > This will alleviate lot of my issues and any help/suggestion in this regard is greatly appreciated !!! > > Thanks a lot !!! > Manikantan. >