Class PoolableManagedConnectionFactory

java.lang.Object
org.apache.commons.dbcp.PoolableConnectionFactory
org.apache.commons.dbcp.managed.PoolableManagedConnectionFactory
All Implemented Interfaces:
org.apache.commons.pool.PoolableObjectFactory

public class PoolableManagedConnectionFactory extends PoolableConnectionFactory
Version:
$Revision$ $Date$
  • Constructor Details

    • PoolableManagedConnectionFactory

      public PoolableManagedConnectionFactory(XAConnectionFactory connFactory, org.apache.commons.pool.ObjectPool pool, org.apache.commons.pool.KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, boolean defaultReadOnly, boolean defaultAutoCommit)
      Create a PoolableManagedConnectionFactory and attach it to a connection pool.
      Parameters:
      connFactory - XAConnectionFactory
      pool - connection pool
      stmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement pooling
      validationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.
      defaultReadOnly - the default "read only" setting for borrowed Connections
      defaultAutoCommit - the default "auto commit" setting for returned Connections
    • PoolableManagedConnectionFactory

      public PoolableManagedConnectionFactory(XAConnectionFactory connFactory, org.apache.commons.pool.ObjectPool pool, org.apache.commons.pool.KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, int validationQueryTimeout, Collection connectionInitSqls, Boolean defaultReadOnly, boolean defaultAutoCommit, int defaultTransactionIsolation, String defaultCatalog, AbandonedConfig config)
      Create a PoolableManagedConnectionFactory and attach it to a connection pool.
      Parameters:
      connFactory - XAConnectionFactory
      pool - connection pool
      stmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements, or null to disable PreparedStatement pooling
      validationQuery - a query to use to validate Connections. Should return at least one row. Using null turns off validation.
      validationQueryTimeout - the number of seconds that validation queries will wait for database response before failing. Use a value less than or equal to 0 for no timeout.
      connectionInitSqls - a Collection of SQL statements to initialize Connections. Using null turns off initialization.
      defaultReadOnly - the default "read only" setting for borrowed Connections
      defaultAutoCommit - the default "auto commit" setting for returned Connections
      defaultTransactionIsolation - the default "Transaction Isolation" setting for returned Connections
      defaultCatalog - the default "catalog" setting for returned Connections
      config - the AbandonedConfig if tracing SQL objects
  • Method Details

    • makeObject

      public Object makeObject() throws Exception
      Uses the configured XAConnectionFactory to create a PoolableManagedConnection. Throws IllegalStateException if the connection factory returns null. Also initializes the connection using configured initialization sql (if provided) and sets up a prepared statement pool associated with the PoolableManagedConnection if statement pooling is enabled.
      Specified by:
      makeObject in interface org.apache.commons.pool.PoolableObjectFactory
      Overrides:
      makeObject in class PoolableConnectionFactory
      Throws:
      Exception