|
||||||||||
| 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.C3P0ConnectionHandler
public class C3P0ConnectionHandler
A connection handler that uses the C3P0 connection pool. (http://sourceforge.net/projects/c3p0) To use this class you must have the C3P0 jar in your /WEB-INF/lib directory. You may access the underlying C3P0's ComboPooledDataSource to configure the pool, before you start calling getConnection().
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.mentawai.db.ConnectionHandler |
|---|
ConnectionHandler.Exec |
| Field Summary | |
|---|---|
static boolean |
DEBUG
|
| Constructor Summary | |
|---|---|
C3P0ConnectionHandler(String driver,
String url,
String user,
String pass)
Constructs a C3P0ConnectionHandler with C3P0's ComboPooledDataSource. |
|
| Method Summary | ||
|---|---|---|
void |
destroy()
Destroy the connection pool, closing and cleaning all connections. |
|
Object |
getBean()
|
|
DataSource |
getComboPooledDataSource()
Gets the underlying C3P0's ComboPooledDataSource. |
|
Connection |
getConnection()
Returns a Connection to the database. |
|
|
getInstance()
|
|
String |
getStatus()
Print the status of this connection pool if any. |
|
Class<? extends Object> |
getType()
|
|
void |
onCleared(Connection conn)
|
|
void |
onCreated(Connection conn)
|
|
void |
release(Connection conn)
Release this connection. |
|
void |
setValue(String param,
Object value)
|
|
| Methods inherited from class org.mentawai.db.AbstractConnectionHandler |
|---|
exec |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static boolean DEBUG
| Constructor Detail |
|---|
public C3P0ConnectionHandler(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 C3P0 jar is not in the /WEB-INF/lib directory or if the JDBC driver cannot be loaded.| Method Detail |
|---|
public void setValue(String param,
Object value)
public String getStatus()
ConnectionHandler
public DataSource getComboPooledDataSource()
public Connection getConnection()
throws SQLException
ConnectionHandler
SQLException - if there were problems trying to acquire the connection.public void onCleared(Connection conn)
public void onCreated(Connection conn)
public Class<? extends Object> getType()
public void release(Connection conn)
ConnectionHandler
conn - The connection to release.public <T> T getInstance()
public Object getBean()
throws InstantiationException
InstantiationExceptionpublic void destroy()
ConnectionHandler
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||