org.apache.commons.dbcp2.cpdsadapter

Class DriverAdapterCPDS

  • All Implemented Interfaces:
    Serializable, Referenceable, ObjectFactory, CommonDataSource, ConnectionPoolDataSource


    public class DriverAdapterCPDS
    extends Object
    implements ConnectionPoolDataSource, Referenceable, Serializable, ObjectFactory

    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 jdbc3 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 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:
    Serialized Form

Copyright © 2001–2018 The Apache Software Foundation. All rights reserved.