com.quadrique.jbuildingblocks.core.database
Class JbbDatabaseClientPool

java.lang.Object
  extended by 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)


Method Summary
 void close()
           
 JbbDatabaseClient getDbHandler()
           
 void init(int maxNbOfDbHandlerInPool, String url, String login, String password, String driver, int loginTimeout)
           
static JbbDatabaseClientPool newInstance()
           
 void releaseDbHandler(JbbDatabaseClient db)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

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.