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.DBCPConnectionProvider
Supported 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)
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
ConnectionProvider,
Serialized Form| Constructor and Description |
|---|
DBCPConnectionProvider() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
closeConnection(Connection conn) |
void |
configure(Map props) |
Connection |
getConnection() |
boolean |
isUnwrappableAs(Class unwrapType) |
protected void |
logStatistics() |
void |
stop() |
boolean |
supportsAggressiveRelease()
Does this connection provider support aggressive release of JDBC connections and re-acquistion of those
connections (if need be) later?
|
<T> T |
unwrap(Class<T> unwrapType) |
public void configure(Map props) throws org.hibernate.HibernateException
configure in interface org.hibernate.service.spi.Configurableorg.hibernate.HibernateExceptionpublic Connection getConnection() throws SQLException
getConnection in interface org.hibernate.engine.jdbc.connections.spi.ConnectionProviderSQLExceptionpublic void closeConnection(Connection conn) throws SQLException
closeConnection in interface org.hibernate.engine.jdbc.connections.spi.ConnectionProviderSQLExceptionpublic void close()
throws org.hibernate.HibernateException
org.hibernate.HibernateExceptionpublic boolean supportsAggressiveRelease()
This is used in conjunction with AvailableSettings.RELEASE_CONNECTIONS to 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.
supportsAggressiveRelease in interface org.hibernate.engine.jdbc.connections.spi.ConnectionProviderprotected void logStatistics()
public boolean isUnwrappableAs(Class unwrapType)
isUnwrappableAs in interface org.hibernate.service.spi.Wrappedpublic <T> T unwrap(Class<T> unwrapType)
unwrap in interface org.hibernate.service.spi.Wrappedpublic void stop()
stop in interface org.hibernate.service.spi.StoppableCopyright © 2004–2021 XWiki. All rights reserved.