Failover
- Last Updated: May 13, 2025
- 2 minute read
- DataDirect Connectors
- JDBC
- Denodo 6.0
- Documentation
The driver provides connection failover support to ensure continuous, uninterrupted access to data. It allows you to specify a list of alternate database servers that are tried at connection time if the primary server is not accepting connections. Connection attempts continue until a connection is successfully established or until all the database servers in the list have been tried the specified number of times.
To configure failover:
- Specify the primary and alternate servers:
- Specify your primary server using a connection URL or data source.
- Specify one or multiple alternate servers by setting the
AlternateServers property.Note: To turn off failover, do not specify a value for the AlternateServers property.
- Optionally, configure the connection retry feature by setting the ConnectionRetryCount and ConnectionRetryDelay connection properties.
- Optionally, set the LoadBalancing property to determine whether the driver attempts to connect to the database servers (primary and alternate) in a random order or a sequential order.
The following examples configure the driver to use connection failover in conjunction with connection retry.
Connection URL
jdbc:datadirect:denodo://myserver1:9996;
DatabaseName=mydb1;User=jsmith;Password=secret;
AlternateServers=(myserver2:9996;DatabaseName=mydb2,myserver3:9996;DatabaseName=mydb3);
ConnectionRetryCount=2;ConnectionRetryDelay=5
In this example:
...myserver1:9996;DatabaseName=mydb1...
is the part of the connection URL that specifies connection information for the primary server. Alternate servers are specified using the AlternateServers property. For example:
...AlternateServers=(myserver2:9996;DatabaseName=mydb2,myserver3:9996;DatabaseName=mydb3)
If you do not specify the DatabaseName connection property in an alternate
server entry, the connection to that alternate server uses the property specified in the URL
for the primary server. For example, if you specify DatabaseName=mydb1 for the primary server, but do not specify a database name in
the alternate server entry, the driver tries to connect to the mydb1 database on the alternate
server.
If a successful connection is not established on the Denodo driver’s first
pass through the list of database servers (primary and alternate), the driver retries the list
of servers in the same sequence twice (ConnectionRetryCount=2). Because the connection retry delay has been set to five
seconds (ConnectionRetryDelay=5), the driver waits five
seconds between retry passes.
DenodoDataSource mds = new DenodoDataSource();
mds.setDescription("My Denodo Data Source");
mds.setServerName("myserver1");
mds.setPortNumber("9996");
mds.setDatabaseName("mydb1");
mds.setUser("jsmith");
mds.setPassword("secret");
mds.setAlternateServers("myserver2:9996;DatabaseName=mydb2,
myserver3:9996,DatabaseName=mydb3");