Specifying Primary and Alternate Servers
- Last Updated: May 15, 2020
- 1 minute read
- DataDirect Connectors
- JDBC
- IBM Db2 5.1
- MySQL 5.1
- Progress OpenEdge 5.1
- SAP Sybase 5.1
- Documentation
Connection information for primary and alternate servers can be specified using either a connection URL through the JDBC Driver Manager or a JDBC data source. For example, the following connection URL for the Progress OpenEdge driver specifies connection information for the primary and alternate servers using a connection URL:
jdbc:datadirect:openedge://server1:2003;HostName=TestServer;
DatabaseName=TestServer;User=test;Password=secret;
AlternateServers=(server2:2003;server3:2003)
In this example:
...server1:2003;DatabaseName=TestServer...
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=(server2:2003;server3:2003)
Similarly, connection information for the primary server specified using a JDBC data source would look something like this:
OpenEdgeDataSource mds = new OpenEdgeDataSource();
mds.setDescription("My OpenEdgeDataSource");
mds.setServerName("server1");
mds.setPortNumber(2003);
mds.setDatabaseName("TestServer");
mds.setUser("test");
mds.setPassword("secret");mds.setAlternateServers=("server2:2003;server3:2003")
In this example, connection information for the primary server is specified using the ServerName, PortNumber, and DatabaseName properties. Connection information for alternate servers is specified using the AlternateServers property.