freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Michael Peppler <mpeppler AT peppler.org>
- To: bpm AT ec-group.com
- Cc: freetds AT lists.ibiblio.org
- Subject: [freetds] Re: ping doesn't seem to work
- Date: Thu, 26 Aug 2004 08:15:04 +0200
On Wed, 2004-08-25 at 22:40, Brian Millett wrote:
> sub ping {
> my $dbh = shift;
> return 0 if DBD::Sybase::db::_isdead($dbh);
>
> # Use "select 1" suggested by Henri Asseily.
> my $sth = $dbh->prepare("select 1");
>
> return 0 if !$sth;
>
> my $rc = $sth->execute;
>
> return 0 if(!defined($rc) && DBD::Sybase::db::_isdead($dbh));
>
> $sth->finish;
> return 1;
> }
>
> Michael, I've noticed that the ping routine doesn't work with freetds.
> I'm using DBD-Sybase-1.0.4.6 with freetds-0.62.1-1 on a linux box to
> talk to a SQLServer 2000 box. When the db goes down, the return code
> from DBD::Sybase::db::_isdead($dbh) is still 0.
I guess the problem is that FreeTDS's CTlib doesn't appear to report
that a connection has been disconnected in the clientmsg callback.
DBD::Sybase uses the following code:
static CS_RETCODE CS_PUBLIC
clientmsg_cb(context, connection, errmsg)
CS_CONTEXT *context;
CS_CONNECTION *connection;
CS_CLIENTMSG *errmsg;
{
....
if(CS_NUMBER(errmsg->msgnumber) == 6) { /* disconnect */
imp_dbh->isDead = 1;
}
...
}
Maybe someone on the freetds list can check into this to see if MS-SQL
reports the same error number for this situation (i.e. when a request is
made on a connection where the server has gone away.)
Michael
--
Michael Peppler Data Migrations, Inc.
mpeppler AT peppler.org http://www.peppler.org/
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short
or long term contract positions - http://www.peppler.org/resume.html
- [freetds] Re: ping doesn't seem to work, Michael Peppler, 08/26/2004
Archive powered by MHonArc 2.6.24.