public class DBCPConnectionHandler extends AbstractConnectionHandler
ConnectionHandler.Exec| Constructor and Description |
|---|
DBCPConnectionHandler(String driver,
String url,
String user,
String pass)
Constructs a DBCPConnectionHandler with DBCP's BasicDataSource.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
exec, getInstance, getType, onCleared, onCreatedpublic 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.public String getStatus()
ConnectionHandlerpublic DataSource getBasicDataSource()
public Connection getConnection() throws SQLException
ConnectionHandlerSQLException - if there were problems trying to acquire the connection.public Object getBean() throws InstantiationException
InstantiationExceptionpublic void release(Connection conn)
ConnectionHandlerconn - The connection to release.public void destroy()
ConnectionHandlerCopyright © 2015. All Rights Reserved.