Class DriverAdapterCPDS

java.lang.Object
org.apache.commons.dbcp2.cpdsadapter.DriverAdapterCPDS
All Implemented Interfaces:
Serializable, Referenceable, ObjectFactory, CommonDataSource, ConnectionPoolDataSource

An adapter for JDBC drivers that do not include an implementation of ConnectionPoolDataSource, but still include a DriverManager implementation. ConnectionPoolDataSources are not used within general applications. They are used by DataSource implementations that pool Connections, such as SharedPoolDataSource. A J2EE container will normally provide some method of initializing the ConnectionPoolDataSource whose attributes are presented as bean getters/setters and then deploying it via JNDI. It is then available as a source of physical connections to the database, when the pooling DataSource needs to create a new physical connection.

Although normally used within a JNDI environment, the DriverAdapterCPDS can be instantiated and initialized as any bean and then attached directly to a pooling DataSource. Jdbc2PoolDataSource can use the ConnectionPoolDataSource with or without the use of JNDI.

The DriverAdapterCPDS also provides PreparedStatement pooling which is not generally available in jdbc2 ConnectionPoolDataSource implementation, but is addressed within the JDBC 3 specification. The PreparedStatement pool in DriverAdapterCPDS has been in the DBCP package for some time, but it has not undergone extensive testing in the configuration used here. It should be considered experimental and can be toggled with the poolPreparedStatements attribute.

The package documentation contains an example using Apache Catalina and JNDI. The datasources package documentation shows how to use DriverAdapterCPDS as a source for Jdbc2PoolDataSource without the use of JNDI.

Since:
2.0
See Also: