org.openmobileis.common.util.database
Class JdbcPoolManagerDB

java.lang.Object
  |
  +--org.openmobileis.common.util.database.ManagerDB
        |
        +--org.openmobileis.common.util.database.JdbcPoolManagerDB

public class JdbcPoolManagerDB
extends ManagerDB

Title: OpenMobileIS project source
Description: This class represents the manager for the SGBDR . It allows to connect a database by giving an url and a jdbc driver It establishes the connection, prepare statement and manage the application queries (using pool connections) All the DB parameters are contained in the database.properties file which is read by the InitFactories class.

Since:
JDK 1.1
Version:
1.0.
Author:
Philippe Delrieu

Constructor Summary
JdbcPoolManagerDB()
          Connect to the database
JdbcPoolManagerDB(java.lang.String alias, java.lang.String srvdriver, java.lang.String dbserver, java.lang.String srvlogin, java.lang.String srvpassword, int monitorinterval, int maxconnection, int idltimeout, int checkouttimeout, int maxcheckout, java.lang.String shutdownquery)
           
 
Method Summary
 void connect()
           
 void disconnect()
          disconnect() method allows to close the database
 void garbageOpenedConnection()
           
 java.sql.Connection getConnection()
          getConnection() return a free connection or null if all the connections are used after a given time out
 boolean isConnected()
           
 
Methods inherited from class org.openmobileis.common.util.database.ManagerDB
getManager, registerManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcPoolManagerDB

public JdbcPoolManagerDB()
Connect to the database
Parameters:
monitor - interval : how many seconds to wait between reaping connections in the pool.
String - driver : jdbc driver bridge (ex: "com.imaginary.sql.msql.MsqlDriver")
String - server url : Name of the database "jdbc:msql:databaseName"
String - login
String - password
int - maximum available connections
idle - timeout : seconds a connection can be idle before it is closed
int - checkout timeout : seconds a connection can be checked out by a thread before it is returned back to the pool
int - maxCheckout : number of times a connection can be re-used before connection to database is closed and re-opened
String - shutdown query called before closing database. For instance, hsql need to query "shutdown compact" explicitly before closing (can be null)
Throws:
IOException - for log file
java.lang.Exception - : Impossible to find the database or to find the driver

JdbcPoolManagerDB

public JdbcPoolManagerDB(java.lang.String alias,
                         java.lang.String srvdriver,
                         java.lang.String dbserver,
                         java.lang.String srvlogin,
                         java.lang.String srvpassword,
                         int monitorinterval,
                         int maxconnection,
                         int idltimeout,
                         int checkouttimeout,
                         int maxcheckout,
                         java.lang.String shutdownquery)
Method Detail

connect

public void connect()
             throws ServiceException

disconnect

public void disconnect()
disconnect() method allows to close the database
Overrides:
disconnect in class ManagerDB
Parameters:
None -  
Returns:
None
Throws:
java.sql.SQLException -  

isConnected

public boolean isConnected()

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
getConnection() return a free connection or null if all the connections are used after a given time out
Overrides:
getConnection in class ManagerDB
Parameters:
: - None
Returns:
: Connection
Throws:
: - None

garbageOpenedConnection

public void garbageOpenedConnection()
Overrides:
garbageOpenedConnection in class ManagerDB


Copyright 2005 e-Care. All Rights Reserved.