JDBC 2.0 with standard extensions provides two mechanisms for connecting to the database:

  • The javax.sql.DataSource interface provides unmanaged physical connections.

  • The javax.sql.ConnectionPoolDataSource interface provides managed physical connections. To connect to a connection pooling data source, you need a managed ConnectionPoolDataSource connection.

Using a connection pool with a JDBC resource

By default, a JDBC resource does not use connection pooling. A connection pool may, however, be attached to a JDBC resource to improve efficiency. When a JDBC resource uses connection pooling, the way Rhino manages connections depends on what interface the datasource class of the persistence instance used by the JDBC resource is an implementation of, as follows:

Interface How Rhino manages connections
 javax.sql.DataSource

uses an internal implementation of ConnectionPoolDataSource to create managed connections

 javax.sql.ConnectionPoolDataSource

uses managed connections from the ConnectionPoolDataSource provided by the persistent instance’s datasource class.

Connection pool configurable parameters

A connection pool has the following configurable parameters:

Parameter What it specifies
 max-connections

Maximum number of active connections a Rhino process can use at any one time.

 max-idle-connections

Maximum number of inactive connections that should be maintained in the connection pool.

This value must be less than or equal to max-connections.

 min-connections

Minimum number of connections that should be maintained in the connection pool.

 max-idle-time

Time in seconds after which an inactive connection may become eligible for discard. An idle connection will not be discarded if doing so would reduce the number of idle connections below the min-connections setting.

If this parameter has the value 0, idle connections will never be discarded.

 idle-check-interval

Time in seconds between idle connection discard checks.

 connection-pool-timeout

Maximum time in milliseconds an SBB will wait for a free connection before a timeout error occurs.

Previous page Next page
Rhino Version 3.0.0