Identifying and connecting to an HDR secondary server


In cases where a simple IBM Informix Primary / HDR Secondary server pair exists, it may be considered unnecessary to implement Informix Connection Manager to manage switching between the two, as OLTP applications can simply connect to whichever is the active Primary in a group defined in the sqlhosts file. This article describes a unique method for connecting appropriate applications to the active HDR Secondary in this scenario.


An identical set of sqlhosts file entries on both Primary and HDR Secondary servers can define a fail-over group in this format:

Copy to Clipboard

(Note that the asterisk causes the specific Informix server to listen on all available TCP interfaces including “localhost”.)

Prior to starting a read-only application, the relevant INFORMIXSERVER environment variable can be set with

Copy to Clipboard

where (detailed below) is an executable shell script (bash or ksh) available in the current PATH, with my_server and secondary being arguments to this script.

Applications that should connect to the Primary would continue to use the group name as usual with:

Copy to Clipboard

If the script is called with primary as the second argument, the Primary server name (DBSERVERNAME or DBSERVERALIAS) is returned for information.

A listing of shell script follows:

Copy to Clipboard


It is not necessary to install and maintain Connection Manager for simple HDR server pairs, as the script makes it possible to soft-code connection to whichever server is in the appropriate mode.


The code fix suggested above is provided “as is” without warranty of any kind, either express or implied, including without limitation any implied warranties of condition, uninterrupted use, merchantability, fitness for a particular purpose, or non-infringement.

Contact us

If you have any questions or would like to find out more about HDR and Informix, simply contact us.


Share this story:

Go to Top