public interface ConnectionPoolDataSource
A ConnectionPoolDataSource represents a data source that manages a pool of connections. It creates ConnectionPool objects. Such connections are opened as needed, although a maximum is usually set. Unused connections are returned to the pool for reuse or disconnection and destruction.
getLoginTimeout
public int getLoginTimeout() throws java.sql.SQLException
This returns the login time-out. A SQLException is thrown if a database access error occurs.
Returns: The maximum amount of time for the connection
getLogWriter
public java.io.PrintWriter getLogWriter() throws java.sql.SQLException
This gets a character output stream used for logging and tracing. A SQLException is thrown if a database access error occurs.
Returns: The log writer for the data source or null when there is no log writer available
getPooledConnection
public PooledConnection getPooledConnection() throws java.sql.SQLException
This method tries to get a database connection from the pool. Some connection pools may implement a time-out that specifies the amount of time allowed to wait for a connection to become available.
If the time-out value is elapsed, if there is no time-out and no available connection, or if a database access error occurs, this method throws a SQLException. The default login and password for the current data source is used. You can use the getPooledConnection(String user, String password) method to provide another login/password pair for the connection.
Returns: A Connection to the database
getPooledConnection
public PooledConnection getPooledConnection(String user, String password) throws java.sql.SQLException
This method tries to get a database connection from the pool using the login/password pair provided as parameters. Some connection pools may implement a time-out that specifies the amount of time allowed to wait for a connection to become available.
If the time-out value is elapsed, if there is no time-out and no available connection, or if a database access error occurs, this method throws a SQLException.
Parameters:
user: | The database user’s login for the requested connection |
password: | The password for the user |
Returns: A Connection to the database
setLoginTimeout
public void setLoginTimeout(int seconds) throws java.sql.SQLException
This provides the maximum time that the data source will wait while attempting to connect to a database. The units are seconds. Zero means that either the database driver internal time-out value is used here at the client side or there is no time-out. A SQLException is thrown if a database access error occurs.
Parameters:
seconds: | The maximum amount of time for the connection |
setLogWriter
public void setLogWriter(java.io.PrintWriter out) throws java.sql.SQLException
This sets the log writer for the data source. A SQLException is thrown if a database access error occurs.
Parameters:
out: | The character output stream to use as a log writer for the data source or null if there is no need to provide a log writer |