Connection failover
- Last Updated: May 13, 2024
- 3 minute read
- DataDirect Connectors
- ODBC
- IBM Informix Wire Protocol 8.0
- Documentation
The driver provides failover protection for new connections only. The driver fails over new connections to an alternate, or backup, database server if the primary database server is unavailable, for example, because of a hardware failure or traffic overload. If a connection to the database is lost, or dropped, the driver does not fail over the connection.
- Client load balancing helps distribute new connections in your environment so that no one server is overwhelmed with connection requests. When client load balancing is enabled, the order in which primary and alternate database servers are tried is random.
- Connection Retry defines the number of times the driver attempts to connect to the primary server and, if configured, alternate database servers after the initial unsuccessful connection attempt.
Refer to Failover in the Progress DataDirect for ODBC Drivers Reference for more information.
To configure failover:
- Specify one or more alternate database servers that are tried at connection time if the primary server is not accepting connections. To do this, use the Alternate Servers 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, specify 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 connection option.
- Optionally, specify 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 connection option.
- Optionally, specify 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 connection option.
The following examples configure the driver to use connection failover in conjunction with some of its optional features. It uses the user ID/password authentication method for authentication.
Connection string
DRIVER=DataDirect 8.0 Informix Wire Protocol;AlternateServers=(HostName=informix:
PortNumber=4321:ServerName=Acct1:Database=Accounting,HostName=255.201.11.24:
PortNumber=4320:ServerName=Acct2:Database=Accounting);ConnectionRetryCount=4;
ConnectionRetryDelay=5;LoadBalancing=1;LogonID=John;Password=secret;
Specifically, 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, to try the primary and alternate servers in a random order, and to attempt reconnecting on new connections only. The additional connection information required for the alternate servers is specified in the data source.
odbc.ini
Driver=ODBCHOME/lib/ivifclxx.so
Description=DataDirect Informix Wire Protocol
...
AlternateServers=(HostName=informix:PortNumber=4321:ServerName=Acct1:
Database=Accounting,HostName=255.201.11.24:PortNumber=4320:
ServerName=Acct2:Database=Accounting)
...
ConnectionRetryCount=4
...
ConnectionRetryDelay=5
...
LoadBalancing=0
...
LogonID=John;
...
Password=secret;
...
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, to try the primary and alternate servers in sequential order (do not use load balancing), and to attempt reconnecting on new connections only.