INFORMIXCONRETRY session environment option

Use the INFORMIXCONRETRY session environment option of the SET ENVIRONMENT statement to specify the maximum number of additional connection attempts that can be made to each database server during a single CONNECT statement in the current session, after the initial connection attempt fails. All these attempts must be made within the time limit that the INFORMIXCONTIME setting specifies.

The INFORMIXCONRETRY session environment option has this syntax:

INFORMIXCONRETRY environment option

SET ENVIRONMENT INFORMIXCONRETRY { '1' | ['integer'] }
Element Description Restrictions Syntax
integer The maximum number of retry attempts during a CONNECT statement Must be greater than zero. If you specify no value, the default behavior is a single retry. Literal Number as Quoted String

Usage

Use the INFORMIXCONRETRY session environment option to specify the maximum number of additional connection attempts that each CONNECT statement can make for a server-to-server connection during the session, if the first attempt of fails to establish a connection to the target database server instance. You can specify a nonzero integer value for this limit on the maximum number of retries by the CONNECT statement:
integer > 0
If the first attempt by the CONNECT statement to establish a connection to a database server fails, this value sets an upper limit on the number of additional attempts.

If no connection with another database has been established after (integer + 1) attempts, or after the time limit that INFORMIXCONTIME specifies has been exceeded, the CONNECT statement returns an error.

For the current session only, the setting of the INFORMIXCONRETRY session environment option overrides any other value that is currently set for the INFORMIXCONRETRY client environment variable or for the INFORMIXCONRETRY configuration parameter.

Order of precedence for INFORMIXCONRETRY settings

This is the descending order of precedence (highest to lowest) among methods for setting the maximum number of retry attempts for CONNECT statements:
  • The SET ENVIRONMENT INFORMIXCONRETRY statement (for a session)
  • The INFORMIXCONRETRY client environment variable setting.
  • If INFORMIXCONRETRY configuration parameter in the onconfig file.
  • The system default value of 1 additional attempt to establish a new connection to a server.

Unless the setting of the INFORMIXCONRETRY session environment option, or of the INFORMIXCONRETRY configuration parameter, or of the INFORMIXCONRETRY environment variable is an integer greater than zero, the default behavior of the CONNECT statement after a failed initial connection attempt is to attempt a single connection retry.

Examples of setting INFORMIXCONRETRY

For example, the following statement resets the INFORMIXCONRETRY session environment option to the default value of 1, restricting the database server to no more than a single additional connection attempt if the first attempt fails:
SET ENVIRONMENT INFORMIXCONRETRY;
The next example specifies that, if the initial connection attempt fails, up to three additional connection attempts are made before the database server issues an error.
SET ENVIRONMENT INFORMIXCONRETRY '3';

You can also use double ( " ) quotation marks to delimit the setting, which allows five retries (or up to a total of 6 connection attempts) in the following example:

SET ENVIRONMENT INFORMIXCONRETRY "5";
Important:

If the INFORMIXCONTIME session environment option or the INFORMIXCONTIME configuration parameter is set to a time interval, that value takes precedence over the INFORMIXCONRETRY setting. That is, the connection attempts can end after the limit in seconds from the INFORMIXCONTIME setting has elapsed, even if this limit is exceeded before the INFORMIXCONRETRY limit on attempts is reached.