|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--dke.smwp.ConnectionPool
Pool which handles database connections.
Field Summary | |
private java.util.Hashtable |
_connections
stores all open connections |
private java.lang.String |
_dbURL
database url |
static java.lang.String |
_errorText
internal error text |
private int |
_increment
number of connections which are being opened if available connections run out |
private java.lang.String |
_password
database password |
private java.lang.String |
_user
database username |
private static boolean |
DEBUG
debug variable |
private static ConnectionPool |
instance
connection pool instance |
Constructor Summary | |
private |
ConnectionPool(java.lang.String dbURL,
java.lang.String user,
java.lang.String password,
java.lang.String driverClassName,
int initialConnections,
int increment)
default constructor - initializes ConnectionPool and creates database connections (number of initial connections defined by initialConnections |
Method Summary | |
protected void |
finalize()
closes all connections wthin pool |
java.sql.Connection |
getConnection()
gets the connection handle |
static ConnectionPool |
getInstance()
gets the sole instance of ConnectionPool |
void |
returnConnection(java.sql.Connection returned)
returns the connection handle to the connection pool |
Methods inherited from class java.lang.Object |
|
Field Detail |
private static final boolean DEBUG
public static java.lang.String _errorText
private java.util.Hashtable _connections
private int _increment
private java.lang.String _dbURL
private java.lang.String _user
private java.lang.String _password
private static ConnectionPool instance
Constructor Detail |
private ConnectionPool(java.lang.String dbURL, java.lang.String user, java.lang.String password, java.lang.String driverClassName, int initialConnections, int increment)
initialConnections
dbURL
- database urluser
- database usernamepassword
- database passworddriverClassName
- class name (e.g. oracle.jdbc.driver.OracleDriver)initialConnection
- number of opened connections by defaultincrement
- number of connections which are opened if available connections are running outMethod Detail |
public static ConnectionPool getInstance()
ConnectionPool
ConnectionPool
public java.sql.Connection getConnection() throws java.sql.SQLException
java.sql.SQLException
- testing open connection failedpublic void returnConnection(java.sql.Connection returned)
returned
- connection handleprotected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |