|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.softtech.jdbc.ConnectionPool
public class ConnectionPool
Manages jdbc connections to the database.
| Nested Class Summary | |
|---|---|
private class |
ConnectionPool.PooledConnection
Pooled connection object |
| Field Summary | |
|---|---|
(package private) java.util.ArrayList |
conPool
Connection pool |
private java.lang.String |
conURL
database connection URL |
private int |
dbType
DatabaseType (e.g. |
private java.lang.String |
driverName
database driver name |
private java.lang.String |
password
database connection password |
private java.lang.String |
username
database connection user name |
| Constructor Summary | |
|---|---|
ConnectionPool(java.sql.Connection con)
Constructor uses the given connection (con) as its connection. |
|
ConnectionPool(int numPooledCon,
java.lang.String driverName,
java.lang.String conURL,
java.lang.String username,
java.lang.String password)
Constructor creates a JDBC connection using given parameters |
|
| Method Summary | |
|---|---|
private void |
addConnectionsToPool(int numPooledCon)
Creates database connection(s) and adds them to the pool. |
void |
closeAllConnections()
Closes all connections in the connection pool. |
(package private) void |
closeConnection(java.sql.Connection con,
int dbType)
method closes the given connection |
java.sql.Connection |
getConnection()
Gets available connection from the pool |
int |
getDbType()
Get the dbType |
int |
getNumConInPool()
Gets the number of connections in the pool |
(package private) void |
releaseConnection(java.sql.Connection con)
Method closeConnection closes the jdbc database connection |
void |
releaseConnection(java.sql.Connection con,
int dbType)
Makes a connection available for reuse (in the connection pool) |
private void |
removeAnyClosedConnections()
|
int |
resizeConnectionPool(int newSize)
Attempts to resize the connection pool to the new size. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.lang.String driverName
private java.lang.String conURL
private java.lang.String username
private java.lang.String password
private int dbType
java.util.ArrayList conPool
| Constructor Detail |
|---|
public ConnectionPool(int numPooledCon,
java.lang.String driverName,
java.lang.String conURL,
java.lang.String username,
java.lang.String password)
databaseType - driverName - conURL - username - password - public ConnectionPool(java.sql.Connection con)
con - dbType - | Method Detail |
|---|
private void addConnectionsToPool(int numPooledCon)
numPooledCon - driverName - conURL - username - password - public int getNumConInPool()
private void removeAnyClosedConnections()
public java.sql.Connection getConnection()
public int getDbType()
void releaseConnection(java.sql.Connection con)
public void closeAllConnections()
public int resizeConnectionPool(int newSize)
newSize -
public void releaseConnection(java.sql.Connection con,
int dbType)
con - ConnectiondbType - int database type
void closeConnection(java.sql.Connection con,
int dbType)
con - connection to closedbType - type of database (used to throw appropriate exception)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||