ConnectTimeout /ODBC and IBM data server driver configuration keyword
Specifies the time in seconds to wait for a reply when trying to establish a connection to a server before terminating the attempt and generating a communication timeout.
- db2cli.ini keyword syntax:
- ConnectTimeout = 0 | 1 |2 | ... | 32767
- IBM® data server driver configuration file (db2dsdriver.cfg) syntax:
- <parameter name="ConnectTimeout" value="0 | 1 |2 | ... | 32767"/>
- Default setting:
- The client waits indefinitely for a reply from the server when trying to establish a connection.
- Equivalent connection attribute:
- SQL_ATTR_LOGIN_TIMEOUT
- Usage notes:
-
One second is the smallest interval for checking the timeout value. Therefore, the timeout event can take up to an additional second after the set timeout value.
If the ConnectTimeout keyword is set and client reroute is enabled against the Db2®, a connection is attempted only once to the original server and once to the alternate server. Because the ConnectTimeout value is used when attempting to connect to each server, the maximum waiting time is approximately double the specified value for ConnectTimeout. If neither server can be reached within the amount of time specified by the keyword, the following error message is returned:SQL30081N A communication error has been detected. Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS". Location where the error was detected: "<ip address>". Communication function detecting the error: "<failing function>". Protocol specific error code(s): "<error code>", "*", "*". SQLSTATE=08001
If ConnectTimeout keyword is set and Sysplex is enabled, a connection is attempted only once for each of the Sysplex members. Because the ConnectTimeout value is used when attempting to connect to each Sysplex member, the maximum waiting time is approximately the number of Sysplex members, times the amount of time specified by the ConnectTimeout keyword.
Regardless of a high availability solution being enabled, the connect timeout value is enforced for a connection. If a connection attempt fails within the time specified by the ConnectTimeout value, control is returned to the application with an SQL30081N error. The error and control is returned whether all alternative servers are tried or not.
The ConnectTimeout keyword applies only to the TCPIP protocol and is not supported for connections to databases cataloged on a SOCKS-enabled TCP/IP node.
A ConnectTimeout value explicitly specified in the db2cli.ini file takes precedence over the SQL_ATTR_LOGIN_TIMEOUT attribute during the execution.