|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jnetdirect.datasource.BaseDatasource
com.jnetdirect.jsql.JSQLDataSource
com.jnetdirect.jsql.JSQLConnectionPoolDataSource
com.jnetdirect.jsql.JSQLPoolingDataSource
public class JSQLPoolingDataSource
PoolingDataSource is a fully JDBC 2.0 compliant connection pool manager for pooling database
connections. Please note that PoolingDataSource is not typically used in managed environments
(e.g.application servers) that already provide a built-in connection pooling implementation.
However, it may be used in any environment if required. For example, if the existing connection
pool manager provides less features than PoolingDataSource.
In a basic DataSource implementation, there is a 1:1 correspondence between the client's connection
object and the physical database connection. When the connection object is closed, the physical
connection is dropped. Thus, the overhead of opening, initializing, and closing the physical connection
is incurred for each client connection.
PoolingDataSource solves this problem by maintaining a cache of physical database connections
that can be reused across client sessions. Connection pooling greatly improves performance and
scalability, particularly in a three-tier environment where multiple clients can share a smaller
number of physical database connections.
Your application requires no code changes to take advantage of connection pooling. Simply
acquire your database connections from PoolingDataSource and they will be pooled automatically.
It is recommended that your application close pooled database connections at the earliest
point when they are no longer required so that they may be returned to the pool for use by other
processes.
PoolingDataSources may be dynamically created by the application or instantiated from JNDI
after they are registered with JNDI registration. JNDI usage is recommended to faciliate
application portability to other JDBC datasources.
PoolingDataSource provides a wide range of paramters to control the management
and behavior of connections pools. For example, PoolingDataSource properties may be configured to
specify :-
Field Summary |
---|
Fields inherited from class com.jnetdirect.datasource.BaseDatasource |
---|
debugLog |
Constructor Summary | |
---|---|
JSQLPoolingDataSource()
|
Method Summary | |
---|---|
void |
closeAllConnections()
Close all connections in the connection pool. |
int |
getAvailableConnectionCount()
Return the total number of physical connections currently available. |
java.sql.Connection |
getConnection()
Obtain a database connection using the datasource user and password properties. |
java.sql.Connection |
getConnection(java.lang.String user,
java.lang.String password)
Obtain a database connection using the supplied user and password properties. |
int |
getConnectionCount()
Return the total number of physical connections open in the pool. |
int |
getErroredConnectionCount()
Return the total number of physical connections that were removed from the pool due to errors in their connections. |
java.lang.Exception |
getLastPhysicalException()
Return the most recent physical connectivity exception, if any. |
java.util.Date |
getLastPhysicalExceptionDate()
Return the most recent physical connectivity exception date(time), if any. |
int |
getLogicalOpennedCount()
Return the total number of logical connections issued. |
java.lang.String |
getStatus()
Get the pool status. |
int |
getTimeOutConnectionCount()
Return the total number of physical connections that were closed because they exceeded the idle time for timeout setting. |
int |
getUsedConnectionCount()
Return the total number of physical connections currently in use. |
boolean |
isWrapperFor(java.lang.Class iface)
|
java.lang.Object |
unwrap(java.lang.Class iface)
|
Methods inherited from class com.jnetdirect.jsql.JSQLConnectionPoolDataSource |
---|
getPooledConnection, getPooledConnection |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.sql.CommonDataSource |
---|
getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter |
Constructor Detail |
---|
public JSQLPoolingDataSource()
Method Detail |
---|
public java.sql.Connection getConnection() throws java.sql.SQLException
BaseDatasource
getConnection
in interface javax.sql.DataSource
getConnection
in class JSQLDataSource
java.sql.SQLException
- The database connection failed.public java.sql.Connection getConnection(java.lang.String user, java.lang.String password) throws java.sql.SQLException
BaseDatasource
getConnection
in interface javax.sql.DataSource
getConnection
in class JSQLDataSource
user
- The user name for the connectionpassword
- The password for the connection
java.sql.SQLException
- The database connection failed.public java.lang.String getStatus()
public void closeAllConnections() throws java.sql.SQLException
java.sql.SQLException
public int getConnectionCount()
public int getUsedConnectionCount()
public int getAvailableConnectionCount()
public int getErroredConnectionCount()
public int getTimeOutConnectionCount()
public int getLogicalOpennedCount()
public java.lang.Exception getLastPhysicalException()
public java.util.Date getLastPhysicalExceptionDate()
public boolean isWrapperFor(java.lang.Class iface) throws java.sql.SQLException
isWrapperFor
in interface java.sql.Wrapper
isWrapperFor
in class JSQLConnectionPoolDataSource
java.sql.SQLException
public java.lang.Object unwrap(java.lang.Class iface) throws java.sql.SQLException
unwrap
in interface java.sql.Wrapper
unwrap
in class JSQLConnectionPoolDataSource
java.sql.SQLException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |