Configuring Connection Failover
Only the SQL Server Wire Protocol driver on UNIX and Linux supports this feature.
Connection failover allows an application to connect to an alternate, or backup, database server if the primary database server is unavailable, for example, because of a hardware failure or traffic overload. Connection failover ensures that the data on which your critical ODBC applications depend is always available. See "Using Connection Failover" for more information.
To configure connection failover, you must specify a list of alternate database servers that are tried at connection time if the primary server is not accepting connections. To do this, use the Alternate Servers (AlternateServers) connection option. Connection attempts continue until a connection is successfully established or until all the database servers in the list have been tried once (the default).
Optionally, you can specify the following additional connection failover features:
- The number of times the driver attempts to connect to the primary and alternate database servers after the initial unsuccessful connection attempt. By default, the driver does not retry. To set this feature, use the Connection Retry Count (ConnectionRetryCount) connection option. See "Using Connection Retry" for more information.
- The wait interval, in seconds, between attempts to connect to the primary and alternate database servers. The default interval is 3 seconds. To set this feature, use the Connection Retry Delay (ConnectionRetryDelay) connection option.
- Whether the driver will use client load balancing in its attempts to connect to primary and alternate database servers. If load balancing is enabled, the driver uses a random pattern instead of a sequential pattern in its attempts to connect. The default value is not to use load balancing. To set this feature, use the Load Balancing (LoadBalancing) connection option. See "Using Client Load Balancing" for more information.
You can configure a data source to use connection failover by modifying your system information file (odbc.ini). See "Configuring the Product on UNIX/Linux" for details. Also, you can use a connection string to direct the driver to use connection failover. See the UNIX and Linux section of "Connecting to a Data Source Using a Connection String" for details.
A Connection String Example
The following connection string configures the SQL Server Wire Protocol driver on UNIX and Linux to use connection failover in conjunction with all of its optional features-load balancing, connection retry, and connection retry delay.
DSN=AcctMSSQLServer; AlternateServers=(Address=\\MySQLServer\Instance1, Address=\\MySQLServer2\Instance1);LoadBalancing=1; ConnectionRetryCount=4;ConnectionRetryDelay=5Specifically, this connection string configures the driver to use two alternate servers as connection failover servers, to attempt to connect four additional times if the initial attempt fails, to wait five seconds between attempts, and to try the primary and alternate servers in a random order. The additional connection information required for the alternate servers is specified in the data source AcctMSSQLServer.
An odbc.ini File Example
To configure the SQL Server Wire Protocol driver on UNIX and Linux to use connection failover in conjunction with some of its optional features in your odbc.ini file, you could set the following connection string attributes:
Driver=ODBCHOME/lib/ddmsss23.so Description=DataDirect 5.3 SQL Server Wire Protocol ... AlternateServers=(Address=\\MySQLServer\Instance1, Address=\\MySQLServer2\Instance1) ... ConnectionRetryCount=4 ConnectionRetryDelay=5 ... LoadBalancing=0 ...Specifically, this odbc.ini configuration tells the driver to use two alternate servers as connection failover servers, to attempt to connect four additional times if the initial attempt fails, to wait five seconds between attempts, and to try the primary and alternate servers in sequential order (do not use load balancing).