Re: DBI question

[email protected] (Ken Foskey)
Newsgroups perl.beginners
Message-ID <1211400810.7999.3.camel@strider>
On Wed, 2008-05-21 at 23:53 +1000, Ken Foskey wrote:
> I have a program that will run literally for days and days.  It monitors
> logs by file tail.  Problem is that I think the DBI is causing problems.
> It is constantly connecting and reconnecting to DB2 for every
> transaction.

The original did not make much sense reading it back.

I want to redesign the application to have an open connection
permanently.  Problem is that I don't trust it,  what happens if DB2 is
shutdown for instance.   I have to recover the connection.  Problem is I
cannot figure out how to check the connection is still OK without
calling something an have it fail.

What I would like to do is replace my connect subroutine with a grab a
cached DBI handle,  check it is still connected and if it is not
'actually' connected,  ie crashed,  then reconnect it an return the new
DBI handle.

Anyone know of a way to tell that a handle is still valid?

Ken
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.