org.norther.tammi.root.hbm.connection
Class DBCPConnectionProvider

java.lang.Object
  extended by org.norther.tammi.root.hbm.connection.DBCPConnectionProvider
All Implemented Interfaces:
ConnectionProvider

public class DBCPConnectionProvider
extends Object
implements ConnectionProvider

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)

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

Constructor Summary
DBCPConnectionProvider()
           
 
Method Summary
 void close()
           
 void closeConnection(Connection conn)
           
 void configure(Properties props)
           
 Connection getConnection()
           
 boolean supportsAggressiveRelease()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBCPConnectionProvider

public DBCPConnectionProvider()
Method Detail

configure

public void configure(Properties props)
               throws HibernateException
Specified by:
configure in interface ConnectionProvider
Throws:
HibernateException

getConnection

public Connection getConnection()
                         throws SQLException
Specified by:
getConnection in interface ConnectionProvider
Throws:
SQLException

closeConnection

public void closeConnection(Connection conn)
                     throws SQLException
Specified by:
closeConnection in interface ConnectionProvider
Throws:
SQLException

close

public void close()
           throws HibernateException
Specified by:
close in interface ConnectionProvider
Throws:
HibernateException

supportsAggressiveRelease

public boolean supportsAggressiveRelease()
Specified by:
supportsAggressiveRelease in interface ConnectionProvider


Copyright © 2004 The Norther Organization. All rights reserved.