Connection failover enhancement

Existing connection failover allows a client application to switch to an alternate ASE server if the primary server becomes unavailable due to an unplanned event, like power outage or a socket failure. This feature is enhanced to allow client applications to failover numerous times to multiple servers using dynamic failover addresses.

With the High Availability enabled, the client application does not need to be configured to know the possible failover targets. ASE keeps the client updated with the best failover list based on cluster membership, logical cluster usage and load distribution. During failover, the client refers to the ordered failover list while attempting to reconnect. If the driver successfully connects to a server, the driver internally updates the list of host values based on the list returned. Otherwise, the driver throws a connection failure exception.


Enabling extended connection failover in jConnect

You can use the connection string to enable connection failover by setting REQUEST_HA_SESSION to true. For example:

URL="jdbc:sybase:Tds:server1:port1,server2:port2,...,
serverN:portN/mydb?REQUEST_HA_SESSION=true"

where server1:port1, server2:port2, ... , serverN:portN is the ordered failover list.

In establishing a connection, jConnect will try to connect to the first host and port specified in the failover list. If unsuccessful, it will go through the list until a connection is established or until the end of the list is reached.

NoteThe list of alternate servers specified in the connection string is used only during initial connection. After the connection is established with any available instance, and the client supports high-availability, the client will receive an updated list of the best possible failover targets from the server. This new list overrides the specified list.


Enabling extended connection failover in ODBC

Using the ODBC user interface

One way to enable the extended connection failover in ODBC is through the ODBC user interface.

StepsUsing the user interface to enable extended failover

  1. Open the Adaptive Server Enterprise dialog box.

  2. Go to the Connection tab.

  3. Select Enable High Availability.

  4. Optionally, enter the alternate servers and ports in the Alternate Servers field using the format:

    server1:port1,server2:port2,...,serverN:portN;
    

In establishing a connection, ODBC Driver by Sybase will first try to connect to the primary host and port defined in the General tab of the Adaptive Server Enterprise dialog box. If ODBC fails to establish a connection, ODBC will go through the list of hosts and ports specified in the Alternate Servers field.

Using the ODBC connection string

Another way to enable the connection failover in ODBC is to set the HASession connection string property to 1. You can use SQLDriverConnect to specify a connection string. For example:

Driver=AdaptiveServerEnterprise;server=server1;
port=port1;UID=sa;PWD=;HASession=1;
AlternateServers=server2:port2,...,serverN:portN;

The preceding example defines server1 and port1 as the primary server and port. If ODBC fails to establish connection to the primary server, and alternate servers are defined, it will go through the ordered list of servers and ports specified in the Alternate Servers field until a connection is established or until the end of the list is reached.

NoteThe list of alternate servers specified in the GUI or the connection string is used only during initial connection. After the connection is established with any available instance, and the client supports high-availability, the client will receive an updated list of the best possible failover targets from the server. This new list overrides the specified list.


Enabling extended connection failover in OLEDB

Using the OLEDB user interface

One way to enable the extended connection failover in OLEDB is through the OLEDB user interface.

StepsUsing the user interface to enable extended failover

  1. Open the Configure Data Source dialog box of the Sybase Datasource Administrator.

  2. Go to the Connection tab.

  3. Select Enable High Availability.

  4. Optionally, enter the alternate servers and ports in the Alternate Servers field using the format:

    server1:port1,server2:port2,...,serverN:portN;
    

In establishing a connection, OLEDB Provider by Sybase will first try to connect to the primary host and port defined in the General tab of the Configure Data Source dialog box. If OLEDB fails to establish a connection, OLEDB will go through the list of hosts and ports specified in the Alternate Servers field.

Using the OLEDB connection string

You can also use the OLEDB connection string to enable extended failover by setting the HASession connection string property to 1. For example:

Provider=ASEOLEDB;User ID=sa;Password=;
InitialCatalog=sdc;Data Source=server1:port1;
ProviderString='HASession=1;AlternateServers=
server2:port2,...,serverN:portN';

In the preceding example, Data Source defines the primary server and port. OLEDB Provider by Sybase will try to establish connection to the primary server first. If unsuccessful, and alternate servers are defined, OLEDB will go through the servers listed in the Alternate Servers field until a connection is established or until the end of the list is reached.

NoteThe list of alternate servers specified in the GUI or the connection string is used only during initial connection. After the connection is established with any available instance and the client supports high-availability, the client will receive an updated list of the best possible failover targets from the server. This new list overrides the specified list.


Enabling extended connection failover in ADO.NET

To enable the extended failover, you need to set the HASession connection string property to 1. For example:

Data Source=server1;Port=port1;User ID=sa;Password=;
Initial Catalog=sdc;HASession=1;
AlternateServers=server2:port2,...,serverN:portN;

In the preceding example, Data Source defines the primary server and port. ADO.NET Provider by Sybase will try to establish connection to the primary server first and, if unsuccessful, will go through the servers listed in Alternate Servers until a connection is established or until the end of the list is reached.

NoteThe list of alternate servers specified in the connection string is used only during initial connection. After the connection is established with any available instance, and the client supports high-availability, the client will receive an updated list of the best possible failover targets from the server. This new list overrides the specified list.