> # Using Connection Failover

> Connection failover allows an application to connect to an alternate, or backup, SequeLink Server if the primary SequeLink Server is unavailable, for example, because of a hardware failure or traffic overload.

> Refer to the SequeLink Administrator's Guide for more information about connection failover.

> To configure connection failover to another server, 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 connection string option. Connection attempts continue until a connection is successfully established or until all the databases in the list have been tried once (the default).

> Optionally, you can specify the following additional connection failover features:

> - The number of times the data provider attempts to connect after the initial connection attempt. By default, the data provider does not retry. To set this feature, use the Connection Retry Count connection string option.
> - The wait interval, in seconds, used between attempts to connect. The default interval is 3 seconds. To set this feature, use the Connection Retry Delay connection string option.
> - Whether the .NET Client will use load balancing in its attempts to connect to primary and alternate SequeLink Servers. If load balancing is enabled, the .NET Client 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 string option.

> You use a connection string to direct the .NET Client to use connection failover. See "Specifying Connection Options" for information about using connection strings.

> The following C# code fragment includes a connection string that configures the .NET Client to use connection failover in conjunction with all of its optional features-load balancing, connection retry, and connection retry delay:

>     SequeLinkConnection Conn = new SequeLinkConnection();
>     Conn = new SequeLinkConnection("Host=server1;port=19996;ServerDataSource=
>     SDSN1:User ID=test;Password=secret;Alternate Servers=(Host=server2:Port=
>     19996:ServerDataSource=SDSN2,Host=server3:Port=19996:ServerDataSource=
>     SDSN3);Connection Retry Count=4;Connection Retry Delay=5;Load Balancing=true;
>     Connection Timeout=60"

> Specifically, this connection string configures the .NET Client 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. Each connection attempt lasts for 60 seconds.