|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibatis.common.jdbc.SimpleDataSource
This is a simple, synchronous, thread-safe database connection pool.
REQUIRED PROPERTIES ------------------- JDBC.Driver JDBC.ConnectionURL JDBC.Username JDBC.Password Pool.MaximumActiveConnections Pool.MaximumIdleConnections Pool.MaximumCheckoutTime Pool.TimeToWait Pool.PingQuery Pool.PingEnabled Pool.PingConnectionsOlderThan Pool.PingConnectionsNotUsedFor Pool.QuietMode
Constructor Summary | |
SimpleDataSource(java.util.Map props)
Constructor to allow passing in a map of properties for configuration |
Method Summary | |
protected void |
finalize()
|
void |
forceCloseAll()
Closes all of the connections in the pool |
long |
getAverageCheckoutTime()
Getter for the average age of a connection checkout |
long |
getAverageOverdueCheckoutTime()
Getter for the average age of overdue connections |
long |
getAverageRequestTime()
Getter for the average time required to get a connection to the database |
long |
getAverageWaitTime()
Getter for the average time spent waiting for connections that were in use |
long |
getBadConnectionCount()
Getter for the number of invalid connections that were found in the pool |
long |
getClaimedOverdueConnectionCount()
Getter for the number of connections that were claimed before they were returned |
java.sql.Connection |
getConnection()
|
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password)
|
long |
getHadToWaitCount()
Getter for the number of requests that had to wait for connections that were in use |
java.lang.String |
getJdbcDriver()
Getter for the name of the JDBC driver class used |
java.lang.String |
getJdbcPassword()
Getter for the JDBC password used |
java.lang.String |
getJdbcUrl()
Getter of the JDBC URL used |
java.lang.String |
getJdbcUsername()
Getter for the JDBC user name used |
int |
getLoginTimeout()
|
java.io.PrintWriter |
getLogWriter()
|
int |
getPoolMaximumActiveConnections()
Getter for the maximum number of active connections |
int |
getPoolMaximumCheckoutTime()
Getter for the maximum time a connection can be used before it *may* be given away again. |
int |
getPoolMaximumIdleConnections()
Getter for the maximum number of idle connections |
int |
getPoolPingConnectionsNotUsedFor()
If a connection has not been used in this many milliseconds, ping the database to make sure the connection is still good. |
int |
getPoolPingConnectionsOlderThan()
Getter for the age of connections that should be pinged before using |
java.lang.String |
getPoolPingQuery()
Getter for the query to be used to check a connection |
int |
getPoolTimeToWait()
Getter for the time to wait before retrying to get a connection |
long |
getRequestCount()
Getter for the number of connection requests made |
java.lang.String |
getStatus()
Returns the status of the connection pool |
boolean |
isPoolPingEnabled()
Getter to tell if we should use the ping query |
void |
setLoginTimeout(int loginTimeout)
|
void |
setLogWriter(java.io.PrintWriter logWriter)
|
static java.sql.Connection |
unwrapConnection(java.sql.Connection conn)
Unwraps a pooled connection to get to the 'real' connection |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SimpleDataSource(java.util.Map props)
props
- - the configuration parametersMethod Detail |
public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
DataSource.getConnection()
public java.sql.Connection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
DataSource.getConnection(java.lang.String, java.lang.String)
public void setLoginTimeout(int loginTimeout) throws java.sql.SQLException
setLoginTimeout
in interface javax.sql.DataSource
java.sql.SQLException
DataSource.setLoginTimeout(int)
public int getLoginTimeout() throws java.sql.SQLException
getLoginTimeout
in interface javax.sql.DataSource
java.sql.SQLException
DataSource.getLoginTimeout()
public void setLogWriter(java.io.PrintWriter logWriter) throws java.sql.SQLException
setLogWriter
in interface javax.sql.DataSource
java.sql.SQLException
DataSource.setLogWriter(java.io.PrintWriter)
public java.io.PrintWriter getLogWriter() throws java.sql.SQLException
getLogWriter
in interface javax.sql.DataSource
java.sql.SQLException
DataSource.getLogWriter()
public int getPoolPingConnectionsNotUsedFor()
public java.lang.String getJdbcDriver()
public java.lang.String getJdbcUrl()
public java.lang.String getJdbcUsername()
public java.lang.String getJdbcPassword()
public int getPoolMaximumActiveConnections()
public int getPoolMaximumIdleConnections()
public int getPoolMaximumCheckoutTime()
public int getPoolTimeToWait()
public java.lang.String getPoolPingQuery()
public boolean isPoolPingEnabled()
public int getPoolPingConnectionsOlderThan()
public long getRequestCount()
public long getAverageRequestTime()
public long getAverageWaitTime()
public long getHadToWaitCount()
public long getBadConnectionCount()
public long getClaimedOverdueConnectionCount()
public long getAverageOverdueCheckoutTime()
public long getAverageCheckoutTime()
public java.lang.String getStatus()
public void forceCloseAll()
public static java.sql.Connection unwrapConnection(java.sql.Connection conn)
conn
- - the pooled connection to unwrap
protected void finalize() throws java.lang.Throwable
java.lang.Throwable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |