Properties for connecting directly to an HDR pair of servers

You can define your client application's connection URL or DataSource so that your application connects directly to an HDR pair of servers. If a connection attempt to the primary server fails, the client application can attempt to connect to the HDR secondary server.

To connect directly to a primary server and HDR secondary server, include the following properties in the connection URL or DataSource:
INFORMIXSERVER=primary_server_name
INFORMIXSERVER_SECONDARY=secondary_server_name
IFXHOST_SECONDARY=secondary_host_name
PORTNO_SECONDARY=secondary_port_number
USER=user_name
PASSWORD=password
ENABLE_HDRSWITCH=true
If you are setting values in the DataSource, you must also include the following values:
IFXHOST=primary_host_name
PORTNO=primary_port_number

When you are using a DataSource object, you can set and get the secondary server connection properties with setXXX() and getXXX() methods. These methods are listed with their corresponding connection property in Get and set connection properties.

You can manually redirect a connection to the secondary server in an HDR pair by editing the INFORMIXSERVER, PORTNO, and IFXHOST properties in the DataSource or by editing the INFORMIXSERVER property in the URL. Manual redirection requires editing the application code and then restarting the application.

Example: Connecting to an HDR pair of servers

The following example shows a connection URL for a primary server that is named server_1 and an HDR secondary server that is named server_2:
jdbc:informix-sqli://my_host:my_port/my_database:
   INFORMIXSERVER=server_1;INFORMIXSERVER_SECONDARY=server_2;
   IFXHOST_SECONDARY=host2.example.com;PORTNO_SECONDARY=port_2;
   user=my_name;password=my_password;
   ENABLE_HDRSWITCH=true