|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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. |
java.sql.Connection |
getConnection()
Retrieve a connection from the given database connection pool. |
void |
init(java.lang.String dbUrl,
java.lang.String dbDriver)
Initialize a database factory with the given URL and driver classname. |
void |
init(java.lang.String dbUrl,
java.lang.String dbDriver,
java.util.Properties properties)
Initialize a database factory with the given URL, driver classname, and database properties. |
void |
init(java.lang.String dbUrl,
java.lang.String dbDriver,
java.lang.String username,
java.lang.String password)
Initialize a database factory with the given URL, driver classname, and database credentials. |
void |
releaseConnection(java.sql.Connection connection)
Replace a database connection back in the pool of available connections for its parent pool. |
Method Detail |
public void init(java.lang.String dbUrl, java.lang.String dbDriver) throws java.lang.ClassNotFoundException, java.sql.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 handles
this JDBC URL
java.lang.ClassNotFoundException
java.sql.SQLException
public void init(java.lang.String dbUrl, java.lang.String dbDriver, java.lang.String username, java.lang.String password) throws java.lang.ClassNotFoundException, java.sql.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
java.lang.ClassNotFoundException
java.sql.SQLException
public void init(java.lang.String dbUrl, java.lang.String dbDriver, java.util.Properties properties) throws java.lang.ClassNotFoundException, java.sql.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 URLproperties
- a collection of database properties, these may be specific to
your particular database
java.lang.ClassNotFoundException
java.sql.SQLException
public void destroy() throws java.sql.SQLException
java.sql.SQLException
public java.sql.Connection getConnection() throws java.sql.SQLException
java.lang.IllegalStateException
- If the factory has not been initialized or has been
destroyed.
java.sql.SQLException
public void releaseConnection(java.sql.Connection connection) throws java.sql.SQLException
connection
- the connection to release
java.lang.IllegalStateException
- If the factory has not been initialized or has been
destroyed.
java.sql.SQLException
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |