org.apache.commons.dbcp

Class PoolableConnectionFactory

Implemented Interfaces:
PoolableObjectFactory

public class PoolableConnectionFactory
extends Object
implements PoolableObjectFactory

A PoolableObjectFactory that creates PoolableConnections.
Version:
$Revision: 1.23 $ $Date: 2004/06/09 18:21:23 $
Authors:
Rodney Waldhoff
Glenn L. Nielsen
James House
Dirk Verbeeck

Constructor Summary

PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, Boolean defaultReadOnly, boolean defaultAutoCommit, int defaultTransactionIsolation, String defaultCatalog, AbandonedConfig config)
Create a new PoolableConnectionFactory.
PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, boolean defaultReadOnly, boolean defaultAutoCommit)
Create a new PoolableConnectionFactory.
PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, boolean defaultReadOnly, boolean defaultAutoCommit, int defaultTransactionIsolation)
Create a new PoolableConnectionFactory.
PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, boolean defaultReadOnly, boolean defaultAutoCommit, int defaultTransactionIsolation, String defaultCatalog, AbandonedConfig config)
Deprecated. AbandonedConfig is now deprecated.
PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, boolean defaultReadOnly, boolean defaultAutoCommit, int defaultTransactionIsolation, AbandonedConfig config)
Deprecated. AbandonedConfig is now deprecated.
PoolableConnectionFactory(ConnectionFactory connFactory, ObjectPool pool, KeyedObjectPoolFactory stmtPoolFactory, String validationQuery, boolean defaultReadOnly, boolean defaultAutoCommit, AbandonedConfig config)
Deprecated. AbandonedConfig is now deprecated.

Method Summary

void
activateObject(Object obj)
void
destroyObject(Object obj)
ObjectPool
getPool()
Object
makeObject()
void
passivateObject(Object obj)
void
setConnectionFactory(ConnectionFactory connFactory)
Sets the ConnectionFactory from which to obtain base Connections.
void
setDefaultAutoCommit(boolean defaultAutoCommit)
Sets the default "auto commit" setting for borrowed Connections
void
setDefaultCatalog(String defaultCatalog)
Sets the default "catalog" setting for borrowed Connections
void
setDefaultReadOnly(boolean defaultReadOnly)
Sets the default "read only" setting for borrowed Connections
void
setDefaultTransactionIsolation(int defaultTransactionIsolation)
Sets the default "Transaction Isolation" setting for borrowed Connections
void
setPool(ObjectPool pool)
Sets the ObjectPool in which to pool Connections.
void
setStatementPoolFactory(KeyedObjectPoolFactory stmtPoolFactory)
Sets the KeyedObjectPoolFactory I use to create KeyedObjectPools for pooling PreparedStatements.
void
setValidationQuery(String validationQuery)
Sets the query I use to validate Connections.
void
validateConnection(Connection conn)
boolean
validateObject(Object obj)

Constructor Details

PoolableConnectionFactory

public PoolableConnectionFactory(ConnectionFactory connFactory,
                                 ObjectPool pool,
                                 KeyedObjectPoolFactory stmtPoolFactory,
                                 String validationQuery,
                                 Boolean defaultReadOnly,
                                 boolean defaultAutoCommit,
                                 int defaultTransactionIsolation,
                                 String defaultCatalog,
                                 AbandonedConfig config)
Create a new PoolableConnectionFactory.
Parameters:
connFactory - the ConnectionFactory from which to obtain base Connections
pool - the ObjectPool in which to pool those Connections
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
defaultTransactionIsolation - the default "Transaction Isolation" setting for returned Connections
defaultCatalog - the default "catalog" setting for returned Connections
config - the AbandonedConfig if tracing SQL objects

PoolableConnectionFactory

public PoolableConnectionFactory(ConnectionFactory connFactory,
                                 ObjectPool pool,
                                 KeyedObjectPoolFactory stmtPoolFactory,
                                 String validationQuery,
                                 boolean defaultReadOnly,
                                 boolean defaultAutoCommit)
Create a new PoolableConnectionFactory.
Parameters:
connFactory - the ConnectionFactory from which to obtain base Connections
pool - the ObjectPool in which to pool those Connections
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

PoolableConnectionFactory

public PoolableConnectionFactory(ConnectionFactory connFactory,
                                 ObjectPool pool,
                                 KeyedObjectPoolFactory stmtPoolFactory,
                                 String validationQuery,
                                 boolean defaultReadOnly,
                                 boolean defaultAutoCommit,
                                 int defaultTransactionIsolation)
Create a new PoolableConnectionFactory.
Parameters:
connFactory - the ConnectionFactory from which to obtain base Connections
pool - the ObjectPool in which to pool those Connections
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
defaultTransactionIsolation - the default "Transaction Isolation" setting for returned Connections

PoolableConnectionFactory

public PoolableConnectionFactory(ConnectionFactory connFactory,
                                 ObjectPool pool,
                                 KeyedObjectPoolFactory stmtPoolFactory,
                                 String validationQuery,
                                 boolean defaultReadOnly,
                                 boolean defaultAutoCommit,
                                 int defaultTransactionIsolation,
                                 String defaultCatalog,
                                 AbandonedConfig config)

Deprecated. AbandonedConfig is now deprecated.

Create a new PoolableConnectionFactory.
Parameters:
connFactory - the ConnectionFactory from which to obtain base Connections
pool - the ObjectPool in which to pool those Connections
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
defaultTransactionIsolation - the default "Transaction Isolation" setting for returned Connections
defaultCatalog - the default "catalog" setting for returned Connections
config - the AbandonedConfig if tracing SQL objects

PoolableConnectionFactory

public PoolableConnectionFactory(ConnectionFactory connFactory,
                                 ObjectPool pool,
                                 KeyedObjectPoolFactory stmtPoolFactory,
                                 String validationQuery,
                                 boolean defaultReadOnly,
                                 boolean defaultAutoCommit,
                                 int defaultTransactionIsolation,
                                 AbandonedConfig config)

Deprecated. AbandonedConfig is now deprecated.

Create a new PoolableConnectionFactory.
Parameters:
connFactory - the ConnectionFactory from which to obtain base Connections
pool - the ObjectPool in which to pool those Connections
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
defaultTransactionIsolation - the default "Transaction Isolation" setting for returned Connections
config - the AbandonedConfig if tracing SQL objects

PoolableConnectionFactory

public PoolableConnectionFactory(ConnectionFactory connFactory,
                                 ObjectPool pool,
                                 KeyedObjectPoolFactory stmtPoolFactory,
                                 String validationQuery,
                                 boolean defaultReadOnly,
                                 boolean defaultAutoCommit,
                                 AbandonedConfig config)

Deprecated. AbandonedConfig is now deprecated.

Create a new PoolableConnectionFactory.
Parameters:
connFactory - the ConnectionFactory from which to obtain base Connections
pool - the ObjectPool in which to pool those Connections
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
config - the AbandonedConfig if tracing SQL objects

Method Details

activateObject

public void activateObject(Object obj)
            throws Exception

destroyObject

public void destroyObject(Object obj)
            throws Exception

getPool

public ObjectPool getPool()

makeObject

public Object makeObject()
            throws Exception

passivateObject

public void passivateObject(Object obj)
            throws Exception

setConnectionFactory

public void setConnectionFactory(ConnectionFactory connFactory)
Sets the ConnectionFactory from which to obtain base Connections.
Parameters:
connFactory - the ConnectionFactory from which to obtain base Connections

setDefaultAutoCommit

public void setDefaultAutoCommit(boolean defaultAutoCommit)
Sets the default "auto commit" setting for borrowed Connections
Parameters:
defaultAutoCommit - the default "auto commit" setting for borrowed Connections

setDefaultCatalog

public void setDefaultCatalog(String defaultCatalog)
Sets the default "catalog" setting for borrowed Connections
Parameters:
defaultCatalog - the default "catalog" setting for borrowed Connections

setDefaultReadOnly

public void setDefaultReadOnly(boolean defaultReadOnly)
Sets the default "read only" setting for borrowed Connections
Parameters:
defaultReadOnly - the default "read only" setting for borrowed Connections

setDefaultTransactionIsolation

public void setDefaultTransactionIsolation(int defaultTransactionIsolation)
Sets the default "Transaction Isolation" setting for borrowed Connections
Parameters:
defaultTransactionIsolation - the default "Transaction Isolation" setting for returned Connections

setPool

public void setPool(ObjectPool pool)
Sets the ObjectPool in which to pool Connections.
Parameters:
pool - the ObjectPool in which to pool those Connections

setStatementPoolFactory

public void setStatementPoolFactory(KeyedObjectPoolFactory stmtPoolFactory)
Parameters:
stmtPoolFactory - the KeyedObjectPoolFactory to use to create KeyedObjectPools for pooling PreparedStatements

setValidationQuery

public void setValidationQuery(String validationQuery)
Sets the query I use to validate Connections. Should return at least one row. Using null turns off validation.
Parameters:
validationQuery - a query to use to validate Connections.

validateConnection

public void validateConnection(Connection conn)
            throws SQLException

validateObject

public boolean validateObject(Object obj)

Copyright © 2001-2003 Apache Software Foundation. Documenation generated January 16 2006.