This chapter describes the failover and load balancing functions provided by tbJDBC.
tbJDBC provides capability to recover some resources automatically when you initiate a connection in a typical application or TAC configuration, or when the connection is lost during a job processing. This capability is referred to as failover.
To use the failover capability, specify the URL of DriverManager.getConnection() in a description format and configure FAILOVER.
Set FAILOVER to one of the following values.
NONE
Disable failover. (Default value)
SESSION
Reestablish a connection by trying to reconnect to another node after a failed
connection.
CURSOR
Recovers java.sql.ResultSet including SESSION. Failover set to this value is available when:
executing a SELECT statement
the ResultSet type is TYPE_FORWARD_ONLY or TYPE_SCROLL_INSENSITIVE
the ResultSet concurrency type is CONCUR_READ_ONLY
using only reusable parameters (volatile data such as java.io.Reader and java.io.InputStream data or string data with the size that is greater than the maximum VARCHAR size cannot be failed over.)
The following example enables failover. When an attempt to connect to svr1 fails, an automatic reattempt occurs to connect to svr2. If all attempts to connect to every server fail, an error occurs.
The following property specifies the maximum number of reattempts to reestablish a connection when the failover capability is enabled.
failover_retry_count
The following properties prevent a client from waiting for a connection infinitely when the client cannot detect a disconnection because of an error.
login_timeout
read_timeout
self_keepalive
tbJDBC provides also an ability to distribute users across multiple nodes in a typical application or TAC configuration, to increase the efficiency of database servers. This ability is referred to as load balancing.. To use the load balancing capability, specify the URL of DriverManager.getConnection() in a description format, and add (load_balance=on).
The following example enables load balancing to distribute users to svr1 and svr2 when initiating connection to servers.
For more information about each property, refer to “” in “”.