|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface DbConnectionFactory
A DbConnectionFactory allocates and deallocates connections
from a database. The concrete implementations of this interface specify a
particular allocation/deallocation policy.
For example, an implementation might use and reuse connections from a persistent pool of connections, while another might dynamically allocate and deallocate connections for each request.
| Method Summary | |
|---|---|
void |
destroy()
Deallocate all the resources that may have been allocated to this database connection factory. |
Connection |
getConnection()
Retrieve a connection from the given database connection pool. |
void |
init(String dbUrl,
String dbDriver,
String username,
String password)
Initialize a database factory with the given URL, driver classname, and database credentials. |
void |
releaseConnection(Connection connection)
Replace a database connection back in the pool of available connections for its parent pool. |
| Method Detail |
|---|
void init(String dbUrl,
String dbDriver,
String username,
String password)
throws ClassNotFoundException,
SQLException
Only one init method should be called.
dbUrl - the JDBC URL used to retrieve connectionsdbDriver - a fully qualified class name for the JDBC driver that will
handle this JDBC URLusername - the name to use to authenticate us with the databasepassword - the credentials use to authenticate the username
ClassNotFoundException - if any.
SQLException - if any.
void destroy()
throws SQLException
SQLException - if any.
Connection getConnection()
throws SQLException
Connection object.
IllegalStateException - If the factory has not been initialized or has been
destroyed.
SQLException - if any.
void releaseConnection(Connection connection)
throws SQLException
connection - the connection to release
IllegalStateException - If the factory has not been initialized or has been
destroyed.
SQLException - if any.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||