Re: detecting a dead connection

From: Gideon (grashkes_at_yahoo.com)
Date: 09/18/04

  • Next message: Andrey: "Re: Export ODBC?"
    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
    >


  • Next message: Andrey: "Re: Export ODBC?"

    Relevant Pages

    • GI Dimming - RESOLVED
      ... screwy or dead on all strings and both cases it was the LM339. ... Swapped a TRIAC out with a known good one off a working board (just 1 ... connection. ... replacing the connector, just did the 'continuity checks' recommended ...
      (rec.games.pinball)
    • Re: Cannot establish a connection.. yet again
      ... "Martin Dabkiewicz" wrote: ... I'm dead in the water. ... >> but connection error stops its getting to the PPC ... >> I think I'm missing some trivial thing. ...
      (microsoft.public.pocketpc.developer)
    • Re: detecting a dead connection
      ... Why do you need to test whether or not the connection is dead? ... use it and have the correct error handling in place. ... What happens if you successfully test that the connection is alive, ... > Gideon. ...
      (microsoft.public.sqlserver.odbc)
    • Re: OT: Son of a beotch Win XP...again
      ... Fire up the PC tonight...no connection. ... Did the repair function, ran ... Network card dead? ...
      (alt.guitar)
    • Re: Error "SQL Server does not allow remote connections"
      ... The application could not connect to the sql server db. ... network is blocking the connection. ... SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 ... integratedSecurity, SqlConnection owningObject) +737554 ...
      (microsoft.public.dotnet.framework.aspnet)