|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mentawai.db.AbstractConnectionHandler
org.mentawai.db.DBCPConnectionHandler
public class DBCPConnectionHandler
A connection handler that uses the Commons DBCP connection pool. (http://jakarta.apache.org/commons/dbcp/) To use this class you must have the DBCP jars in your /WEB-INF/lib directory. You may access the underlying DBCP's BasicDataSource to configure the pool, before you start calling getConnection().
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.mentawai.db.ConnectionHandler |
|---|
ConnectionHandler.Exec |
| Constructor Summary | |
|---|---|
DBCPConnectionHandler(String driver,
String url,
String user,
String pass)
Constructs a DBCPConnectionHandler with DBCP's BasicDataSource. |
|
| Method Summary | |
|---|---|
void |
destroy()
Destroy the connection pool, closing and cleaning all connections. |
DataSource |
getBasicDataSource()
Gets the underlying DBCP's BasicDataSource. |
Object |
getBean()
|
Connection |
getConnection()
Returns a Connection to the database. |
String |
getStatus()
Print the status of this connection pool if any. |
void |
release(Connection conn)
Release this connection. |
| Methods inherited from class org.mentawai.db.AbstractConnectionHandler |
|---|
exec, getInstance, getType, onCleared, onCreated |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DBCPConnectionHandler(String driver,
String url,
String user,
String pass)
driver - The JDBC driver class name to use.url - The JDBC url to connect to the database.user - The database username to use.pass - The database password to use.
IllegalStateException - If the Commons DBCP jars are not in the /WEB-INF/lib directory or if the JDBC driver cannot be loaded.| Method Detail |
|---|
public String getStatus()
ConnectionHandler
public DataSource getBasicDataSource()
public Connection getConnection()
throws SQLException
ConnectionHandler
SQLException - if there were problems trying to acquire the connection.
public Object getBean()
throws InstantiationException
InstantiationExceptionpublic void release(Connection conn)
ConnectionHandler
conn - The connection to release.public void destroy()
ConnectionHandler
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||