Class DBCPConnectionProvider
- java.lang.Object
-
- com.xpn.xwiki.store.DBCPConnectionProvider
-
- All Implemented Interfaces:
Serializable,org.hibernate.engine.jdbc.connections.spi.ConnectionProvider,org.hibernate.service.Service,org.hibernate.service.spi.Configurable,org.hibernate.service.spi.Stoppable,org.hibernate.service.spi.Wrapped
public class DBCPConnectionProvider extends Object implements org.hibernate.engine.jdbc.connections.spi.ConnectionProvider, org.hibernate.service.spi.Configurable, org.hibernate.service.spi.Stoppable
A connection provider that uses an Apache commons DBCP connection pool.
To use this connection provider set:
hibernate.connection.provider_class org.hibernate.connection.DBCPConnectionProviderSupported Hibernate properties: hibernate.connection.driver_class hibernate.connection.url hibernate.connection.username hibernate.connection.password hibernate.connection.isolation hibernate.connection.autocommit hibernate.connection.pool_size hibernate.connection (JDBC driver properties)
All DBCP properties are also supported by using the hibernate.dbcp prefix. A complete list can be found on the DBCP configuration page: http://jakarta.apache.org/commons /dbcp/configuration.html.
Example: hibernate.connection.provider_class org.hibernate.connection.DBCPConnectionProvider hibernate.connection.driver_class org.hsqldb.jdbcDriver hibernate.connection.username sa hibernate.connection.password hibernate.connection.url jdbc:hsqldb:test hibernate.connection.pool_size 20 hibernate.dbcp.initialSize 10 hibernate.dbcp.maxWait 3000 hibernate.dbcp.validationQuery select 1 from dual
More information about configuring/using DBCP can be found on the DBCP website. There you will also find the DBCP wiki, mailing lists, issue tracking and other support facilities
- Author:
- Dirk Verbeeck
- See Also:
ConnectionProvider, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DBCPConnectionProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidcloseConnection(Connection conn)voidconfigure(Map props)ConnectiongetConnection()booleanisUnwrappableAs(Class unwrapType)protected voidlogStatistics()voidstop()booleansupportsAggressiveRelease()Does this connection provider support aggressive release of JDBC connections and re-acquistion of those connections (if need be) later?<T> Tunwrap(Class<T> unwrapType)
-
-
-
Method Detail
-
configure
public void configure(Map props) throws org.hibernate.HibernateException
- Specified by:
configurein interfaceorg.hibernate.service.spi.Configurable- Throws:
org.hibernate.HibernateException
-
getConnection
public Connection getConnection() throws SQLException
- Specified by:
getConnectionin interfaceorg.hibernate.engine.jdbc.connections.spi.ConnectionProvider- Throws:
SQLException
-
closeConnection
public void closeConnection(Connection conn) throws SQLException
- Specified by:
closeConnectionin interfaceorg.hibernate.engine.jdbc.connections.spi.ConnectionProvider- Throws:
SQLException
-
close
public void close() throws org.hibernate.HibernateException- Throws:
org.hibernate.HibernateException
-
supportsAggressiveRelease
public boolean supportsAggressiveRelease()
Does this connection provider support aggressive release of JDBC connections and re-acquistion of those connections (if need be) later?This is used in conjunction with
AvailableSettings.RELEASE_CONNECTIONSto aggressively release JDBC connections. However, the configured ConnectionProvider must support re-acquisition of the same underlying connection for that semantic to work.Typically, this is only true in managed environments where a container tracks connections by transaction or thread.
- Specified by:
supportsAggressiveReleasein interfaceorg.hibernate.engine.jdbc.connections.spi.ConnectionProvider
-
logStatistics
protected void logStatistics()
-
isUnwrappableAs
public boolean isUnwrappableAs(Class unwrapType)
- Specified by:
isUnwrappableAsin interfaceorg.hibernate.service.spi.Wrapped
-
unwrap
public <T> T unwrap(Class<T> unwrapType)
- Specified by:
unwrapin interfaceorg.hibernate.service.spi.Wrapped
-
stop
public void stop()
- Specified by:
stopin interfaceorg.hibernate.service.spi.Stoppable
-
-