INFORMIXCONTIME session environment option
Use the INFORMIXCONTIME session environment option of the SET ENVIRONMENT statement to set an upper limit on the number of seconds while the current session attempts to establish a connection to another database server, before an error is returned.
The INFORMIXCONTIME session environment option has this syntax:
Element | Description | Restrictions | Syntax |
---|---|---|---|
integer | An unsigned integer value > 0 sets
the maximum number of seconds to attempts to establish a connection
to a database server |
Must be delimited between single (' )
or double (" ) quotation marks. A setting of '0' defaults
to the setting of the INFORMIXCONTIME configuration
parameter. |
Literal Number as Quoted String |
Usage
- 'integer' >
0
- This value sets an upper limit on the time spent attempting to establish a connection, including (if the initial attempt fails) at least one additional attempt.
After the time limit that INFORMIXCONTIME specifies has been exceeded, or if no connection with another database server has been established after (integer_R + 1) attempts, for integer_R the INFORMIXCONRETRY setting, the CONNECT statement or the implicit connection fails, and the database server returns an error. By setting the INFORMIXCONTIME and INFORMIXCONRETRY session environment variables to configure your sever-to-server connection capability in the current session, you can minimize connection errors. To estimate the optimal value for INFORMIXCONTIME, take into account the total distance between nodes, the hardware speed, the volume of traffic, and the concurrency level of the network.
Order of precedence for time limits on connections
This is the ascending order of precedence (lowest to highest) among the methods for setting an upper limit on the amount of time that a CONNECT statement can spend attempting to connect to a database server instance:
- System default value of 60 seconds, if none of the methods below are set.
- INFORMIXCONTIME configuration parameter
- INFORMIXCONTIME client environment variable
SET ENVIRONMENT INFORMIXCONTIME
statement of SQL.
The INFORMIXCONTIME session environment option can override the setting of the client INFORMIXCONTIME environment variable, or of the INFORMIXCONTIME configuration parameter, or of the system default value, if any of these has established a time limit different from the SET ENVIRONMENT INFORMIXCONTIME value.
Setting session environment options for connections
The value of the INFORMIXCONTIME session environment option is divided by the value of the INFORMIXCONRETRY session environment option to determine the maximum number of seconds between successive connection attempts, if the previous attempt of the same CONNECT statement failed to establish a connection.
SET ENVIRONMENT INFORMIXCONTIME '60'; SET ENVIRONMENT INFORMIXCONRETRY '1';In this example, the CONNECT statement attempts to establish a connection for 60 seconds. An initial attempt is made to connect to the database server at
0
seconds.
If the INFORMIXCONTIME session environment option is set to the default
value of '0'
, an additional attempt to connect is
made within 60
seconds, if necessary, before connection
failure error -908
is returned. SET ENVIRONMENT INFORMIXCONRETRY '3';
If
INFORMIXCONRETRY is set to '3'
, up to three additional
attempts to connect to the database server are made (at 20
, 40
,
and 60
seconds, if necessary), before an error is
returned.
This 20-second interval is the result of dividing the INFORMIXCONTIME value by the INFORMIXCONRETRY value.
'0'
,
as in this example,SET ENVIRONMENT INFORMIXCONTIME '0';
the database server automatically uses the setting of
the INFORMIXCONTIME configuration parameter.
If the INFORMIXCONTIME parameter is not set,
its default value of 60
seconds is used during subsequent
CONNECT statements in the session. Implicit connections with database statements
- DATABASE
- CREATE DATABASE
- DROP DATABASE
- a database server and a database,
- or a database server only,
- or a database only.
- All appropriate servers in the DBPATH setting are accessed at least once, even if the INFORMIXCONTIME value is exceeded. In this context, the CONNECT statement might take longer than the INFORMIXCONTIME time limit to return an error that indicates a connection failure, or indicating that the database was not found.
- The INFORMIXCONTIME value is divided among the number of database
server entries that are specified in DBPATH.
Thus, if DBPATH contains numerous servers, you
can use the SET ENVIRONMENT INFORMIXCONTIME statement to increase
the INFORMIXCONTIME value accordingly. For example, if DBPATH contains
three entries, in order to spend at least
30
seconds attempting each connection, set INFORMIXCONTIME to'90'
.SET ENVIRONMENT INFORMIXCONTIME '90';