|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.paneris.jal.model.DBConnectionManager
public class DBConnectionManager
This class is a Singleton that provides access to one or many connection pools for databases defined in a Property file. A client gets access to the single instance through the static getInstance() method and can then check-out and check-in connections from a pool. When the client shuts down it should call the release() method to close all open connections and do other clean up.
Field Summary | |
---|---|
static int |
ACCESS
|
static int |
MYSQL
|
static int |
POSTGRES
|
static int |
UNKNOWN
Constants representing different RDBMSs |
Method Summary | |
---|---|
void |
freeConnection(java.lang.String name,
java.sql.Connection con)
Returns a connection to the named pool. |
java.sql.Connection |
getConnection(java.lang.String callingClass,
java.lang.String name)
Returns an open connection. |
java.sql.Connection |
getConnection(java.lang.String callingClass,
java.lang.String name,
long time)
Returns an open connection. |
int |
getDatabaseEngineType(java.lang.String db)
get the database name |
java.lang.String |
getDatabaseProductVersion(java.lang.String db)
get the database version |
static DBConnectionManager |
getInstance()
Returns the single instance, creating one if it's the first time this method is called. |
java.util.Hashtable |
getPools()
get the pool names |
java.lang.String |
getUploadDir()
get the upload directory |
void |
release()
Closes all open connections and deregisters all drivers. |
java.lang.String |
sqlFalse(java.lang.String db)
Database-dependent representation of a 'false' boolean value |
java.lang.String |
sqlToday(java.lang.String db)
Database-dependent SQL operator to insert today's date |
java.lang.String |
sqlTrue(java.lang.String db)
Database-dependent representation of a 'true' boolean value |
java.lang.String |
sqlUppercaseOperator(java.lang.String db)
Database-dependent SQL operator to uppercase a value |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int UNKNOWN
public static final int POSTGRES
public static final int ACCESS
public static final int MYSQL
Method Detail |
---|
public static DBConnectionManager getInstance()
public void freeConnection(java.lang.String name, java.sql.Connection con)
name
- The pool name as defined in the properties filecon
- The Connectionpublic java.util.Hashtable getPools()
public java.lang.String getUploadDir()
public int getDatabaseEngineType(java.lang.String db)
db
- The name of the database
public java.lang.String getDatabaseProductVersion(java.lang.String db) throws java.lang.Exception
java.lang.Exception
public java.sql.Connection getConnection(java.lang.String callingClass, java.lang.String name)
name
- The pool name as defined in the properties file
public java.sql.Connection getConnection(java.lang.String callingClass, java.lang.String name, long time)
name
- The pool name as defined in the properties filetime
- The number of milliseconds to wait
public void release()
public java.lang.String sqlUppercaseOperator(java.lang.String db) throws java.lang.Exception
db
- The name of the database
java.lang.Exception
public java.lang.String sqlToday(java.lang.String db) throws java.lang.Exception
java.lang.Exception
public java.lang.String sqlTrue(java.lang.String db)
public java.lang.String sqlFalse(java.lang.String db)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |