|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibatis.common.jdbc.SimpleDataSource
public class 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
Nested Class Summary | |
---|---|
static class |
SimpleDataSource.SimplePooledConnection
--------------------------------------------------------------------------------------- SimplePooledConnection --------------------------------------------------------------------------------------- |
Constructor Summary | |
---|---|
SimpleDataSource(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 |
Connection |
getConnection()
|
Connection |
getConnection(String username,
String password)
|
long |
getHadToWaitCount()
Getter for the number of requests that had to wait for connections that were in use |
String |
getJdbcDriver()
Getter for the name of the JDBC driver class used |
String |
getJdbcPassword()
Getter for the JDBC password used |
String |
getJdbcUrl()
Getter of the JDBC URL used |
String |
getJdbcUsername()
Getter for the JDBC user name used |
int |
getLoginTimeout()
|
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 |
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 |
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(PrintWriter logWriter)
|
static Connection |
unwrapConnection(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(Map props)
props
- - the configuration parametersMethod Detail |
---|
public Connection getConnection() throws SQLException
getConnection
in interface DataSource
SQLException
DataSource.getConnection()
public Connection getConnection(String username, String password) throws SQLException
getConnection
in interface DataSource
SQLException
DataSource.getConnection(java.lang.String, java.lang.String)
public void setLoginTimeout(int loginTimeout) throws SQLException
setLoginTimeout
in interface DataSource
SQLException
DataSource.setLoginTimeout(int)
public int getLoginTimeout() throws SQLException
getLoginTimeout
in interface DataSource
SQLException
DataSource.getLoginTimeout()
public void setLogWriter(PrintWriter logWriter) throws SQLException
setLogWriter
in interface DataSource
SQLException
DataSource.setLogWriter(java.io.PrintWriter)
public PrintWriter getLogWriter() throws SQLException
getLogWriter
in interface DataSource
SQLException
DataSource.getLogWriter()
public int getPoolPingConnectionsNotUsedFor()
public String getJdbcDriver()
public String getJdbcUrl()
public String getJdbcUsername()
public String getJdbcPassword()
public int getPoolMaximumActiveConnections()
public int getPoolMaximumIdleConnections()
public int getPoolMaximumCheckoutTime()
public int getPoolTimeToWait()
public 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 String getStatus()
public void forceCloseAll()
public static Connection unwrapConnection(Connection conn)
conn
- - the pooled connection to unwrap
protected void finalize() throws Throwable
finalize
in class Object
Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |