Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.0 (Français) » SQL Anywhere Server - Programming » ODBC support » Choosing an ODBC connection function » Establishing a connection

 

Getting connection attributes

You use the SQLGetConnectAttr function to get details of the connection. For example, the following statement returns the connection state.

retcode = SQLGetConnectAttr( dbc, SQL_ATTR_CONNECTION_DEAD,
   (SQLPOINTER)&closed, SQL_IS_INTEGER, 0 );

When using the SQLGetConnectAttr function to get the SQL_ATTR_CONNECTION_DEAD attribute, the value SQL_CD_TRUE is returned if the connection has been dropped even if no request has been sent to the server since the connection was dropped. Determining if the connection has been dropped is done without making a request to the server, and the dropped connection is detected within a few seconds. The connection can be dropped for several reasons, such as an idle timeout.

For more information, including a list of connection attributes, see SQLGetConnectAttr in the Microsoft ODBC API Reference at [external link] http://msdn.microsoft.com/en-us/library/ms710297.aspx.