com.quadrique.jbuildingblocks.core.database
Class JbbDatabaseClientPool
java.lang.Object
com.quadrique.jbuildingblocks.core.database.JbbDatabaseClientPool
public class JbbDatabaseClientPool
- extends Object
A single-threaded pool of DatabaseHandler (the underlying database connections are opened once and reused as oppposed to being ccreated/closed every single time)
newInstance
public static JbbDatabaseClientPool newInstance()
- Returns:
- a new instance
init
public void init(int maxNbOfDbHandlerInPool,
String url,
String login,
String password,
String driver,
int loginTimeout)
throws Exception
- Parameters:
maxNbOfDbHandlerInPool - url - the JDBC URL of the database,login - the login to use for the database connection,password - the password to use for the database connection,driver - the driver class to use (e.g. "sun.database.odbc.JdbcOdbcDriver"),loginTimeout - the maximum time in seconds that a driver will wait
while attempting to connect to a database.
- Throws:
Exception
getDbHandler
public JbbDatabaseClient getDbHandler()
throws Exception
- Returns:
- a DatabaseHandler instance connected to the database
- Throws:
Exception
releaseDbHandler
public void releaseDbHandler(JbbDatabaseClient db)
throws Exception
- Parameters:
db -
- Throws:
Exception
close
public void close()
throws Exception
- Throws:
Exception
Copyright © 2001-2008 Quadrique Corporation. All Rights Reserved.