[unixODBC-support] Checking connection status with ODBC

Nick Gorham nick at lurcher.org
Tue Jan 13 17:15:24 GMT 2009


Alan J Batsford wrote:

>I'm using unixODBC 2.2.14 on CentOS 4.6. Right now I'm using ODBC to
>connect to postgreSQL 8.2.5 within a C/C++ program, but the DSN is going to
>change to Oracle soon. I can make a connection and run queries. What's the
>best way to generically check the connection status?
>
>Thanks for all your advise.
>
>
>-Alan
>  
>
Hi,

The official ODBC way is to use SQLGetConnectAttr( 
SQL_ATTR_CONNECTION_DEAD ), but you need to check if its supported by 
the particular driver you are using. The other way that is often used is 
a simple query, but its a problem finding something that will work 
against multiple back ends.

-- 
Nick


More information about the unixODBC-support mailing list