|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.xmlserv.util.PGConnectionPool
An implementation of the ConnectionPool interface for the PostgreSQL Database.
The connection URL has the following format:
jdbc:postgresql://host:port/database
Constructor Summary | |
PGConnectionPool()
Instantiate without connecting. |
|
PGConnectionPool(java.lang.String url,
java.lang.String username,
java.lang.String password)
Connect to the given DB, initializing the pool with default size. |
|
PGConnectionPool(java.lang.String url,
java.lang.String username,
java.lang.String password,
int startPoolSize)
Connect to the given DB, initializing the pool with the given number of connections. |
Method Summary | |
java.sql.Connection |
checkoutConn()
Get a connection. |
void |
destroy()
Destroy pool, closing all DB connections. |
int |
getPoolIncrement()
|
java.lang.String |
getStatus()
Get status report. |
void |
init(java.lang.String url,
java.lang.String username,
java.lang.String password,
int startPoolSize)
Initialize object with given number of connections. |
void |
returnConn(java.sql.Connection conn)
Return a Connection object. |
void |
setPoolIncrement(int incr)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PGConnectionPool()
public PGConnectionPool(java.lang.String url, java.lang.String username, java.lang.String password, int startPoolSize) throws java.sql.SQLException
url
- The connection URL in the format jdbc:postgresql://host:port/database.username
- The username for authentication.password
- The corresponding password.startPoolSize
- The initial pool size.java.sql.SQLException
- Upon failure.public PGConnectionPool(java.lang.String url, java.lang.String username, java.lang.String password) throws java.sql.SQLException
url
- The connection URL in the format jdbc:postgresql://host:port/database.username
- The username for authentication.password
- The corresponding password.java.sql.SQLException
- Upon failure.Method Detail |
public void init(java.lang.String url, java.lang.String username, java.lang.String password, int startPoolSize) throws java.sql.SQLException
init
in interface ConnectionPool
url
- The connection URL in the format jdbc:postgresql://host:port/database.username
- The username for authentication.password
- The corresponding password.startPoolSize
- The initial pool size.java.sql.SQLException
- Upon failure.public void destroy()
destroy
in interface ConnectionPool
public java.lang.String getStatus()
public java.sql.Connection checkoutConn() throws java.sql.SQLException
checkoutConn
in interface ConnectionPool
java.sql.SQLException
- If pool is empty and cannot be grown.public void returnConn(java.sql.Connection conn) throws java.sql.SQLException
returnConn
in interface ConnectionPool
conn
- The Connection to return.java.sql.SQLException
- Indicates a Problem shrinking the pool.public void setPoolIncrement(int incr)
public int getPoolIncrement()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |