Product Documentation

FairCom ODBC

Previous Topic

Next Topic

ODBC Driver Socket SEND/RECV Timeout

A send/recv timeout option is available such that a FairCom DB ODBC client can request a timeout for a connection socket. If the client experiences a lengthy wait for the server to reply, the client can continue to work after closing the connection.

A FairCom DB ODBC driver can set the timeout with a call to the SQLSetConnectAttr() ODBC API function and the SQL_ATTR_CONNECTION_TIMEOUT parameter with the time value in seconds.


/* Set socket timeout to 5 seconds. */

SQLSetConnectAttr(hdbc, (void*)SQL_ATTR_CONNECTION_TIMEOUT, 5, 0);

Note: SQLSetConnectAttr(SQL_ATTR_CONNECTION_TIMEOUT) sets the timeout value for the entire ODBC driver, not just for the current connection. A default value of 0 indicates no timeout.