Re: detecting a dead connection
From: Gideon (grashkes_at_yahoo.com)
Date: 09/18/04
- Previous message: serge: "Re: How does ODBC's authentication work?"
- In reply to: Brannon Jones: "Re: detecting a dead connection"
- Next in thread: Brannon Jones: "Re: detecting a dead connection"
- Reply: Brannon Jones: "Re: detecting a dead connection"
- Messages sorted by: [ date ] [ thread ]
Date: 18 Sep 2004 11:58:03 -0700
Hi Brannon, and thanks for you reply.
I've done some more research and here's what I came up with.
Lets focus for now solely on SQLGetConnectAttr.
I need to use it to find out whether the connection is alive or not
before I attempt to use it, as I want to refrain from using exception
handling in this case.
I've found out that on SQL Server 2000, the const
'SQL_COPT_SS_CONNECTION_DEAD' has a different value than
'SQL_ATTR_CONNECTION_DEAD' (1244 and 1209, respectively).
However, I am still experiencing some strange behaviour.
Using SQLGetConnectAttr with 'SQL_COPT_SS_CONNECTION_DEAD' on a dead
SQL Server connection (i.e. using a SQL Server 2000 driver) I can
detect that the connection is dead. After reconnecting however, the
function does not detect that the connection is running again, and
says that the connection is dead still.
As my system needs to work with Oracle and DB2 connections as well,
things get messier.
With DB2, there's no problem, other than I have to use the old const
'SQL_ATTR_CONNECTION_DEAD' to make it work.
With the Oracle driver, neither seem to work.
To sum up:
On SQL Server - I cannot detect that the connection is running again.
On DB2 - fine.
On Oracle - the function always says the connection alive.
Thanks for your help,
Gideon.
"Brannon Jones" <brannonjNOSPAM@gmail.com> wrote in message news:<#mv$brOnEHA.1412@tk2msftngp13.phx.gbl>...
> I'm curious what problem you've heard exists with SQL_ATTR_CONNECTION_DEAD?
>
> Why do you need to test whether or not the connection is dead? Just try to
> use it and have the correct error handling in place.
>
> What happens if you successfully test that the connection is alive, and then
> it dies a second later? You have to handle that error case anyway, so why
> worry about testing to see if it's dead or not?
>
> Brannon
>
- Previous message: serge: "Re: How does ODBC's authentication work?"
- In reply to: Brannon Jones: "Re: detecting a dead connection"
- Next in thread: Brannon Jones: "Re: detecting a dead connection"
- Reply: Brannon Jones: "Re: detecting a dead connection"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|