public class C3P0ConnectionHandler extends AbstractConnectionHandler
ConnectionHandler.Exec| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEBUG |
| Constructor and Description |
|---|
C3P0ConnectionHandler(String driver,
String url,
String user,
String pass) |
C3P0ConnectionHandler(String driver,
String url,
String user,
String pass,
String testQuery)
Constructs a C3P0ConnectionHandler with C3P0's ComboPooledDataSource.
|
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroy the connection pool, closing and cleaning all connections.
|
Object |
getBean() |
com.mchange.v2.c3p0.ComboPooledDataSource |
getComboPooledDataSource()
Gets the underlying C3P0's ComboPooledDataSource.
|
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 C3P0ConnectionHandler(String driver, String url, String user, String pass, String testQuery)
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.testQuery - The test sql statement used to test the db connection.IllegalStateException - If the C3P0 jar is not in the /WEB-INF/lib directory or if the JDBC driver cannot be loaded.public String getStatus()
ConnectionHandlerpublic com.mchange.v2.c3p0.ComboPooledDataSource getComboPooledDataSource()
public Connection getConnection() throws SQLException
ConnectionHandlerSQLException - if there were problems trying to acquire the connection.public void release(Connection conn)
ConnectionHandlerconn - The connection to release.public Object getBean() throws InstantiationException
InstantiationExceptionpublic void destroy()
ConnectionHandlerCopyright © 2015. All Rights Reserved.