DB2 Version 9.7 for Linux, UNIX, and Windows

Configuring TCP/IP keepalive parameters for high availability clients (JDBC)

About this task

For a client system that uses the IBM® Data Server Driver for JDBC and SQLJ, TCP/IP keepalive settings are set at the operating system level by adjusting the following parameters. The values provided in these commands are suggested values, but you should fine-tune these settings based on your specific network and server capabilities.
Note: By altering these settings at an operating system level, this will affect all TCP/IP communications on the client.


  1. Updating AIX
    For an AIX client, there are three operating system keepalive parameters to change:
    • tcp_keepidle - the length of time to keep an idle TCP connection active
    • tcp_keepintvl - the interval between packets sent to validate the TCP connection
    • tcp_keepcnt - the number of keepalive probes to be sent before terminating the connection
    On the AIX operating system, update these parameters using the "network option" command:
    no -o tcp_keepidle=12
    no -o tcp_keepintvl=2
    no -o tcp_keepcnt=10
    The tcp_keepidle and tcp_keepintvl values are expressed in half-seconds.
  2. Updating Linux
    For a Linux client, there are four operating system keepalive parameters to change:
    • tcp_keepalive_probes - the number of probes that are sent and unacknowledged before the client considers the connection broken and notifies the application layer
    • tcp_keepalive_time - the interval between the last data packet sent and the first keepalive probe
    • tcp_keepalive_intvl - the interval between subsequent keepalive probes
    • tcp_retries2 - the maximum number of times a packet is retransmitted before giving up

    On the Linux operating system, update these parameters using the "echo" command:

    echo "6" > /proc/sys/net/ipv4/tcp_keepalive_time
    echo "1" > /proc/sys/net/ipv4/tcp_keepalive_intvl
    echo "10" > /proc/sys/net/ipv4/tcp_keepalive_probes
    echo "3" > /proc/sys/net/ipv4/tcp_retries2
    The tcp_keepalive_time and tcp_keepalive_intvl values are expressed in seconds. To retain these values after a system restart, they must be added to the /etc/sysctl.conf file.

What to do next

For other client platforms, refer to your operating system documentation on how to set TCP/IP keepalive values.