[unixODBC-support] SQLDisconnect()

Nick Gorham nick at lurcher.org
Wed Apr 11 13:56:45 BST 2012

On 11/04/12 13:21, Antony Davies wrote:
> Hi, in order to test some code that handles disconnects I added some code to do an explicit SQLDisconnect() on an open connection.
> However, the code that detects a disconnect (and I am know this works for an actual physical disconnect from the server) still seems to report that its connected.
> This snippet of code detects whether it is still connected or not:
>      SQLUINTEGER val;
>      ::SQLGetConnectAttr(hconn,SQL_ATTR_CONNECTION_DEAD,
>                            (SQLPOINTER)&val,0,NULL);
>      if (SQL_CD_FALSE == val) return true;
>      return false;
> Does the disconnect happen asynchronously (ie sometime after the call to SQLDisconnect() returns ) ?
> I think this is version 2.2.11
Check the return valve from the SQLGetConnectAttr, it may/should be 
returning a error (08003)


More information about the unixODBC-support mailing list