Scalable Database Server, HiRDB Version 8 UAP Development Guide

[Contents][Index][Back][Next]

16.4.2 Connection pooling

A function is provided in the JDBC2.0 Optional Package for pooling connections to a database. An overview of connection pooling is provided below:

Table 16-11 shows classes related to connection pooling.

Table 16-11 Classes related to connection pools

Class Overview
javax.sql.DataSource
  • Provided by a connection pooling function.
  • Used as the interface to applications during database connection.
  • Normally, connection pools are controlled in this class.
  • Normally, registered in JNDI for use.
  • Different from the DataSource class provided by the JDBC driver.
javax.sql.ConnectionPoolDataSource
  • Provided by the JDBC driver.
  • Can use a method for setting/acquiring connection information necessary for database connection.
  • Normally not used directly from an application, and is used by a connection pooling function.
  • Normally, registered in JNDI for use.
  • A connection pooling function acquires a PooledConnection object from this class of objects.
javax.sql.PooledConnection
  • Provided by the JDBC driver.
  • Normally not used directly from an application, and is used by a connection pooling function.
  • A connection pooling function targets this class of objects for pooling.
  • A connection pooling function acquires a Connection object to be used by an application from this class of objects.
javax.sql.ConnectionEventListener
  • Provided by a connection pooling function.
  • A connection pooling function senses a connection pooling trigger by detecting a disconnection or SQL error through this class of objects.

Depending on the JDK version, the interface definition of the classes shown in Table 16-11 might not be included in the JDK standard; you will need to check the JavaSoft website if you intend to use the connection pooling function.

The following are the package name and class names of the classes provided by the JDBC driver and shown in Table 16-11.

Package name: JP.co.Hitachi.soft.HiRDB.JDBC

ConnectionPoolDataSource class name: JdbhConnectionPoolDataSource

PooledConnection class name: JdbhPooledConnection

Note that the setting of the connection information of the ConnectionPoolDataSource class provided by the JDBC driver is the same as the setting of the connection information of the DataSource class provided by the JDBC driver.