IBM Support

IBM Toolbox for Java Socket Timeout

Troubleshooting


Problem

This document explains how the default receive timeout (no limit) on a toolbox connection can be specified by using a SocketProperties object or a connection property.

Resolving The Problem

IBM Toolbox for Java uses the default socket send-receive timeout values for the platform it is running on. These values can lead to long delays if an unexpected network error occurs. For example, the default send timeout is typically around 12 minutes, and the default receive timeout is typically infinite.

There are a few ways to change the default receive timeout. In all cases, the value is set by using a milliseconds value, and 0 indicates no timeout.

Login timeout

The toolbox supports the use of a login timeout value. This value determines how long the toolbox waits for a new socket to one of the host servers to be established. The timeout can be set by using one of the following techniques:
  • Calling the DriverManager "setLoginTimeout" method.
  • Calling the AS400JDBCDataSource "setLoginTimeout" method.
  • Setting the "login timeout" property of a JDBC connection.
  • Calling the "setLoginTimeout" method on a SocketProperties object, and then calling "setSocketProperties" on an AS400 object.
Receive timeout

The toolbox also supports setting the default receive timeout value; it determines how long the toolbox blocks on a read operation while waiting for a server response. This can be set by using one of the following methods:
  • Calling the AS400JDBCDataSource "setSocketTimeout" method.
  • Setting the "socket timeout" property of a JDBC connection.
  • Calling the "setSoTimeout" method on a SocketProperties object, and then calling "setSocketProperties" on an AS400 object.

Note these values affect only the receive timeout, and not the send timeout of the socket object.

CAUTION: The receive timeout is used only if the "thread used" property of the connection is set to false. By default, the toolbox creates a thread that is always blocked on a socket read waiting for a server response. A connection that is idle longer than the receive timeout, drops the connection. The "setThreadUsed" property can be set by using one of the following methods:
  • Calling the AS400JDBCDataSource "setThreadUsed" method.
  • Setting the "thread used" property of a JDBC connection.
  • Calling the "setThreadUsed" method of an AS400 object.

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Component":"Data Access","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]

Historical Number

28394902

Document Information

Modified date:
15 July 2022

UID

nas8N1016795