public class ConnectionManager
extends java.lang.Object
| Constructor and Description |
|---|
ConnectionManager(java.lang.String driverClass,
java.lang.String url)
Create a new
ConnectionManager instance. |
| Modifier and Type | Method and Description |
|---|---|
ConnectionResource |
getConnectionResource()
Get a
ConnectionResource object from the pool, or create a
new one if the pool is empty. |
void |
releaseConnection(ConnectionResource cr)
Return a
ConnectionResource back to the pool. |
public ConnectionManager(java.lang.String driverClass,
java.lang.String url)
throws java.lang.ClassNotFoundException
ConnectionManager instance.driverClass - the name of the JDBC driver classurl - the JDBC connection URL to the databasejava.lang.ClassNotFoundException - if the JDBC driver class cannot be foundpublic ConnectionResource getConnectionResource() throws java.sql.SQLException
ConnectionResource object from the pool, or create a
new one if the pool is empty. Callers should make sure that the object
is returned to the pool by calling
releaseConnection(ConnectionResource) after they are finished
with it.ConnectionResource objectjava.sql.SQLException - if a database error occurspublic void releaseConnection(ConnectionResource cr) throws java.sql.SQLException
ConnectionResource back to the pool.cr - java.sql.SQLException