PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: Checking mid program if connection still exists
Date: Dec 31 2002 4:50PM

On Wed, 2002-12-18 at 07:29, Stern, Meir wrote:
> Dear all,
> 
> I sthere a way to check to see if te connection to the database is still
> available at the time I would like to use it meaning I can have the control
> handle because of the original; connection but it may be stale already. (I
> need to connect once on top but do not need to use the connection till way
> into the program wwhere it is in a loop) 

You can use $dbh->DBDEAD(). If this returns true then you need to
reconnect to the server. Note that the connection is only marked DEAD
*after* an attempt to use it fails, so it has to be checked not only
*before* using it, but also after using it if any of the calls fail.

Michael
-- 
Michael Peppler                              Data Migrations, Inc.
mpeppler@peppler.org                 http://www.mbay.net/~mpeppler
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or 
long term contract positions - http://www.mbay.net/~mpeppler/resume.html