|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.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().
| Constructor Summary | |
|---|---|
C3P0ConnectionHandler(java.lang.String driver,
java.lang.String url,
java.lang.String user,
java.lang.String pass)
Constructs a C3P0ConnectionHandler with C3P0's ComboPooledDataSource. |
|
| Method Summary | |
|---|---|
void |
destroy()
Destroy the connection pool, closing and cleaning all connections. |
javax.sql.DataSource |
getComboPooledDataSource()
Gets the underlying C3P0's ComboPooledDataSource. |
java.sql.Connection |
getConnection()
Returns a Connection to the database. |
void |
release(java.sql.Connection conn)
Release this connection. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public C3P0ConnectionHandler(java.lang.String driver,
java.lang.String url,
java.lang.String user,
java.lang.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.
java.lang.IllegalStateException - If the C3P0 jar is not in the /WEB-INF/lib directory or if the JDBC driver cannot be loaded.| Method Detail |
|---|
public javax.sql.DataSource getComboPooledDataSource()
public java.sql.Connection getConnection()
throws java.sql.SQLException
ConnectionHandler
getConnection in interface ConnectionHandlerjava.sql.SQLException - if there were problems trying to acquire the connection.public void release(java.sql.Connection conn)
ConnectionHandler
release in interface ConnectionHandlerconn - The connection to release.public void destroy()
ConnectionHandler
destroy in interface ConnectionHandler
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||