Skip to content

Timeout

Timeout#

This section gives an explanation of timeouts which can occur in a client session connected to the Altibase server and provides code examples to show how to set properties related to timeouts.

Login Timeout#

A login timeout occurs when a connect method of a Connection object is called and a response is not received from the server within the maximum waiting time. The maximum waiting time is set in the login_timeout property and the unit is seconds.

Code Examples#

The following are code examples which show two ways to set the login_timeout property.

  1. Create a Connection object with the Properties object to which the timeout property has been added.

    Properties sProps = new Properties();
    ...
    sProps("login_timeout", "100");
    ...
    Connection sCon = DriverManager.getConnection( sUrl, sProps );
    
  2. Create a Connection object with a connection URL which specifies the timeout property.

    String sUrl = "jdbc:Altibase://localhost:20300/mydb? login_timeout=100";
    Connection sCon = DriverManager.getConnection( sUrl );
    

Response Timeout#

A response timeout occurs when the maximum waiting time for a response from the Altibase server is exceeded. The maximum waiting time is set in the response_timeout property and the unit is seconds.

This value is applied to all methods which communicate with the server.

Code Examples#

The following are code examples which show different ways to set the response_timeout property

  1. Create a Connection object with a Properties object to which the timeout property has been added.

    Properties sProps = new Properties();
    ...
    sProps("response_timeout", "100");
    ...
    Connection sCon = DriverManager.getConnection( sUrl, sProps );
    
  2. Create a Connection object with a connection URL which specifies the timeout property.

    String sUrl = "jdbc:Altibase://localhost:20300/mydb? response_timeout=100";
    Connection sCon = DriverManager.getConnection( sUrl );
    
  3. Pass it as an argument when the application is running.

    java ... -DALTIBASE_RESPONSE_TIMEOUT=100 ...
    
  4. Set the environment variable.

    # Linux
    export ALTIBASE_RESPONSE_TIMEOUT=100