1.51.2

interbase.interclient
Class ConnectionPoolModule

java.lang.Object
  |
  +--interbase.interclient.ConnectionPoolModule

public class ConnectionPoolModule
extends Object
implements javax.sql.DataSource, javax.naming.Referenceable, Serializable

The ConnectionPoolModule class implements the javax.sql.DataSource interface so that an instance of ConnectionPoolModule can be registered with JNDI as a JDBC DataSource. Instances of the ConnectionPoolModule class will be used directly by applications to create database connections. ConnectionPoolModule supports one standard data source property, DataSourceName, which is used to locate a connection pool data source when one is needed. A ConnectionPoolDataSource is only used when there is a miss in the connection cache. In this case, a second JNDI lookup() operation is done to produce a ConnectionPoolDataSource object. The ConnectionPoolDataSource object is used to create a new PooledConnection object.

Since:
Extension, proposed for future release, not yet supported
Version:
Std Ext 0.7
See Also:
Serialized Form

Constructor Summary
ConnectionPoolModule()
           
 
Method Summary
 Connection getConnection()
          Attempt to establish a database connection.
 Connection getConnection(String user, String password)
           
 String getDataSourceName()
           
 int getLoginTimeout()
          Gets the maximum time in seconds that this data source can wait while attempting to connect to a database.
 PrintWriter getLogWriter()
          Get the log writer for this data source.
 javax.naming.Reference getReference()
          Creates a JNDI naming Reference of this data source.
 void setDataSourceName(String s)
           
 void setLoginTimeout(int seconds)
          Sets the maximum time in seconds that this data source will wait while attempting to connect to a database.
 void setLogWriter(PrintWriter out)
          Set the log writer for this data source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionPoolModule

public ConnectionPoolModule()
Method Detail

getConnection

public Connection getConnection()
                         throws SQLException
Attempt to establish a database connection.
Specified by:
getConnection in interface javax.sql.DataSource
Returns:
a Connection to the database
Throws:
SQLException - if a database-access error occurs.
Since:
Extension, proposed for future release, not yet supported

getConnection

public Connection getConnection(String user,
                                String password)
                         throws SQLException
Specified by:
getConnection in interface javax.sql.DataSource
Since:
Extension, proposed for future release, not yet supported

getDataSourceName

public String getDataSourceName()
Since:
Extension, proposed for future release, not yet supported

setDataSourceName

public void setDataSourceName(String s)
Since:
Extension, proposed for future release, not yet supported

getLogWriter

public PrintWriter getLogWriter()
                         throws SQLException
Get the log writer for this data source.

The log writer is a character output stream to which all logging and tracing messages for this data source object instance will be printed. This includes messages printed by the methods of this object, messages printed by methods of other objects manufactured by this object, and so on. Messages printed to a data source specific log writer are not printed to the log writer associated with the java.sql.Drivermanager class. When a DataSource object is created the log writer is initially null, in other words, logging is disabled.

Specified by:
getLogWriter in interface javax.sql.DataSource
Returns:
the log writer for this data source, null if disabled
Throws:
SQLException - if a database-access error occurs.
Since:
JDBC 2 Standard Extension, proposed for future release, not yet supported

setLogWriter

public void setLogWriter(PrintWriter out)
                  throws SQLException
Set the log writer for this data source.

This method provides a way to register a character stream to which tracing and error logging information will be written by a JDBC implementation. This allows for DataSource specific tracing. If one wants all Data-Sources to use the same log stream, one must register the stream with each DataSource object individually. Log messages written to a DataSource specific log stream are not written to the log stream maintained by the DriverManager. When a DataSource object is created the log writer is initially null, in other words, logging is disabled.

The log writer is a character output stream to which all logging and tracing messages for this data source object instance will be printed. This includes messages printed by the methods of this object, messages printed by methods of other objects manufactured by this object, and so on. Messages printed to a data source specific log writer are not printed to the log writer associated with the java.sql.Drivermanager class. When a DataSource object is created the log writer is initially null, in other words, logging is disabled.

Specified by:
setLogWriter in interface javax.sql.DataSource
Parameters:
out - the new log writer; to disable, set to null
Throws:
SQLException - if a database-access error occurs.
Since:
JDBC 2 Standard Extension, proposed for future release, not yet supported

setLoginTimeout

public void setLoginTimeout(int seconds)
                     throws SQLException
Sets the maximum time in seconds that this data source will wait while attempting to connect to a database. A value of zero specifies that the timeout is the default system timeout if there is one; otherwise it specifies that there is no timeout. When a DataSource object is created the login timeout is initially zero.
Specified by:
setLoginTimeout in interface javax.sql.DataSource
Parameters:
seconds - the data source login time limit
Throws:
SQLException - if a database access error occurs.
Since:
JDBC 2 Standard Extension, proposed for future release, not yet supported

getLoginTimeout

public int getLoginTimeout()
                    throws SQLException
Gets the maximum time in seconds that this data source can wait while attempting to connect to a database. A value of zero means that the timeout is the default system timeout if there is one; otherwise it means that there is no timeout. When a DataSource object is created the login timeout is initially zero.
Specified by:
getLoginTimeout in interface javax.sql.DataSource
Returns:
the data source login time limit
Throws:
SQLException - if a database access error occurs.
Since:
JDBC 2 Standard Extension, proposed for future release, not yet supported

getReference

public javax.naming.Reference getReference()
                                    throws javax.naming.NamingException
Creates a JNDI naming Reference of this data source.
Specified by:
getReference in interface javax.naming.Referenceable
Returns:
the non-null reference of this object
Throws:
javax.naming.NamingException - if a naming exception was encountered while retrieving the reference
Since:
Extension, proposed for future release, not yet supported

1.51.2

Send comments or suggestions to interclient@interbase.com