Connecting to a Failover Server

ODBC and SQL Server

ODBC and SQL Server

Connecting to a Failover Server

The Microsoft® SQL Server™ ODBC driver supports a failover configuration using the driver-specific SQL_FALLBACK_CONNECT connection option for SQLSetConnectAttr and SQLGetConnectAttr. If the server you are connecting to has a failover server, the driver can connect to the failover server if the primary server is unavailable.

ODBC applications can take advantage of SQL Server's failover feature by calling SQLSetConnectAttr with SQL_FALLBACK_CONNECT enabled before connecting. When the driver connects to the primary server, it retrieves all the information it needs to connect to the failover server and stores the information in the client registry. If the application then loses its connection to the primary server, it completes its current transaction and attempts to reconnect to the primary server. If unsuccessful, it uses the registry information to attempt to connect to the failover server.

See Also

SQLGetConnectAttr

SQLSetConnectAttr