Class com.imaginary.sql.msql.MsqlPooledDataSource
java.lang.Object
|
+--com.imaginary.sql.msql.MsqlDataSource
|
+--com.imaginary.sql.msql.MsqlPooledDataSource
- public final class MsqlPooledDataSource
- extends MsqlDataSource
- implements javax.sql.ConnectionPoolDataSource, javax.sql.ConnectionEventListener
The mSQL-JDBC implementation of the JDBC 2.0 standard extension
connection pooling API. Connection pooling is actually something
transparent to application developers. It is configured in the
JNDI directory storing this class instead of MsqlDataSource
.
The result is a data source with a pool of connections up to a specified
maxPoolSize
value. If a connection is requested after the
pool has reached its max size, the MsqlPooledDataSource
implementation will wait until one of the in-use connections is
released. In addition to maxPoolSize
, you should also
configure the directory entry with the attributes of a
MsqlDataSource
.
Last modified $Date: 1999/07/06 05:56:08 $
- Version:
- $Revision: 1.3 $
- Author:
- George Reese (borg@imaginary.com)
- See Also:
- Serialized Form
Method Summary
|
void
|
connectionClosed(javax.sql.ConnectionEvent event)
This method is called whenever a pooled connection that is in
used gets closed. |
void
|
connectionErrorOccurred(javax.sql.ConnectionEvent event)
This method is called whenever errors occur to a pooled
connection. |
java.sql.Connection
|
getConnection(java.util.Properties p)
|
int
|
getMaxPoolSize()
|
javax.sql.PooledConnection
|
getPooledConnection()
Constructs a pooled connection using the default user/password. |
javax.sql.PooledConnection
|
getPooledConnection(java.lang.String uid,
java.lang.String pw)
|
javax.naming.Reference
|
getReference()
Creates a reference to this object. |
void
|
setMaxPoolSize(int sz)
Sets the maximum size for the connection pool. |
Methods inherited from class com.imaginary.sql.msql.MsqlDataSource |
getConnection, getConnection, getConnection, getDatabaseName, getEncoding, getLoginTimeout, getLogWriter, getPort, getReference, getServerName, getURL, getUser, setDatabaseName, setEncoding, setLoginTimeout, setLogWriter, setPassword, setPort, setServerName, setUser |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait |
MsqlPooledDataSource
public MsqlPooledDataSource()
- Constructs a new pooled data source.
connectionClosed
public void connectionClosed(javax.sql.ConnectionEvent event)
- This method is called whenever a pooled connection that is in
used gets closed.
- Specified by:
- connectionClosed(javax.sql.ConnectionEvent) in interface javax.sql.ConnectionEventListener
- Parameters:
event
- the closing event
connectionErrorOccurred
public void connectionErrorOccurred(javax.sql.ConnectionEvent event)
- This method is called whenever errors occur to a pooled
connection.
- Specified by:
- connectionErrorOccurred(javax.sql.ConnectionEvent) in interface javax.sql.ConnectionEventListener
- Parameters:
event
- the error event
getConnection
protected java.sql.Connection getConnection(java.util.Properties p)
throws java.sql.SQLException
- Returns:
- a pooled connection using the specified properties
- Throws:
- java.sql.SQLException - a connection error occurred
- Overrides:
- getConnection in class MsqlDataSource
getMaxPoolSize
public int getMaxPoolSize()
- Returns:
- the maximum size of the connection pool
getPooledConnection
public javax.sql.PooledConnection getPooledConnection()
throws java.sql.SQLException
- Constructs a pooled connection using the default user/password.
- Specified by:
- getPooledConnection() in interface javax.sql.ConnectionPoolDataSource
- Returns:
- a database connection
- Throws:
- java.sql.SQLException - a connection error occurred
getPooledConnection
public javax.sql.PooledConnection getPooledConnection(java.lang.String uid,
java.lang.String pw)
throws java.sql.SQLException
- Description copied from interface:
- Specified by:
- getPooledConnection(java.lang.String, java.lang.String) in interface javax.sql.ConnectionPoolDataSource
- Parameters:
uid
- the user ID for the connection
pw
- the password for the connection- Returns:
- a database connection
- Throws:
- java.sql.SQLException - a connection error occurred
getReference
public javax.naming.Reference getReference()
throws javax.naming.NamingException
- Creates a reference to this object.
- Returns:
- the reference
- Throws:
- javax.naming.NamingException - a naming error occurred
- Overrides:
- getReference in class MsqlDataSource
setMaxPoolSize
public void setMaxPoolSize(int sz)
- Sets the maximum size for the connection pool.
- Parameters:
sz
- the max size