MDAC 2.5 SDK - ODBC Programmer's Reference
Chapter 18: Installing ODBC Components


 

Preventing Repeated Connection Attempts

When Connection Pooling is enabled and the database server has become unavailable, the Driver Manager attempts to reestablish a connection to the server repeatedly. ODBCSetTryWaitValue and ODBCGetTryWaitValue prevent this and, consequently, the large number of generated requests. ODBCSetTryWaitValue saves the information in the registry at the following location:

HKEY_LOCAL_MACHINE
     SOFTWARE
          Odbc
               Odbcinst.ini
                    ODBC Connection Pooling
                         Retry Wait

If there is a bad connection in the pool, the ODBC Driver Manager will attempt to connect before the connection can be reused for the first time. If the connection still fails, the ODBC Driver Manager returns the error and marks the connection with the time. From that point until the RetryWait value expires, the ODBC Driver Manager returns a failure without testing the connection.

ODBCSetTryWaitValue

BOOL ODBCSetTryWaitValue ( DWORD dwValue );

Arguments

dwValue [Input]

The number of seconds to wait until the Driver Manager attempts to connect again.

Returns

The function returns TRUE if it is successful, FALSE if it fails.

ODBCGetTryWaitValue

DWORD ODBCGetTryWaitValue ( );

Arguments

None.

Returns

The function returns a DWORD value containing the number of seconds the Driver Manager will wait before attempting to connect again.