|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.genericdao.ConnectionPool
public class ConnectionPool
Field Summary | |
---|---|
static long |
DEFAULT_MAX_IDLE_TIME
Default max idle time for connections. |
Constructor Summary | |
---|---|
ConnectionPool(String jdbcDriverName,
String jdbcURL)
|
|
ConnectionPool(String jdbcDriverName,
String jdbcURL,
String user,
String password)
|
Method Summary | |
---|---|
Connection |
getConnection()
|
PrintWriter |
getDebugWriter()
|
String |
getDriverName()
Gets the JDBC Driver Name that this connection pool uses. |
boolean |
getLowerCaseColumnNames()
|
long |
getMaxIdleTime()
Get the maximum time that after which idle database connections are closed. |
Connection |
getTransactionConnection()
Get the database connection used by the thread's current transaction. |
String |
getURL()
Gets the JDBC URL that this connection pool uses. |
String |
getUserName()
Gets the user name that this connection pool uses to log into the database. |
void |
releaseConnection(Connection c)
Returns a connection to the connection pool. |
void |
setDebugOutput(OutputStream out)
Sets up an output stream to which debugging output can be printed. |
void |
setMaxIdleTime(long millis)
Changes the time after which idle database connections are closed. |
String |
toString()
Returns a description of this connection pool, include the JDBC Driver Name, the JDBC URL, and the user name used to log into the database. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final long DEFAULT_MAX_IDLE_TIME
Constructor Detail |
---|
public ConnectionPool(String jdbcDriverName, String jdbcURL)
public ConnectionPool(String jdbcDriverName, String jdbcURL, String user, String password)
Method Detail |
---|
public Connection getConnection() throws SQLException
SQLException
public PrintWriter getDebugWriter()
public String getDriverName()
public boolean getLowerCaseColumnNames()
public long getMaxIdleTime()
public Connection getTransactionConnection() throws RollbackException
The connection is returned to the connection pool (for you) when the transaction is committed or rolled back.
Note that current only one connection pool can be used in any transaction (because the ACID properties cannot be guaranteed without a lot of work and complication, e.g., using the two-phase commit protocol).
RollbackException
- if there is no active transaction, if there is an underlying SQL exception,
or if there is already another connection pool using the currently active transaction. If this exception is thrown,
the currently running transaction is rolled back.public String getURL()
public String getUserName()
public void releaseConnection(Connection c)
c
- public void setDebugOutput(OutputStream out)
out
- public void setMaxIdleTime(long millis)
millis
- time a connection can be idle before it will be closedpublic String toString()
toString
in class Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |