Skip navigation links

Oracle® TimesTen In-Memory Database JDBC Extensions Java API Reference
Release 11.2.1

E13083-02


com.timesten.jdbc
Class ObservableConnection

java.lang.Object
  extended by com.timesten.jdbc.JdbcOdbcObject
      extended by com.timesten.jdbc.ObservableConnection

All Implemented Interfaces:
javax.sql.PooledConnection

public class ObservableConnection
extends com.timesten.jdbc.JdbcOdbcObject
implements javax.sql.PooledConnection

An ObservableConnection implements the the PooledConnection interface, as defined in JDBC 2.0 An ObservableConnection holds a physical connection to a data source, and is itself a factory for ProxyConnection objects. There can be many ConnectionEventListener (observers) registered with an ObservableConnection. These observers are notified if the user calls close on the connection, or if there is an error on the connection that renders it useless, such as a data store invalidation. This interface is usually used by an application server connection pool implementation, and not directly by an user application.

NOTE: TimesTen JDBC driver itself does NOT implement database connection pools. This class merely implements PooledConnection, a standard J2EE interface, which faciliates creation and management of database connection pools per the J2EE standard.

Since:
JDBC 2.0

Constructor Summary
ObservableConnection(com.timesten.jdbc.JdbcOdbcConnection conn)
          Constructs an ObservableConnection object.
ObservableConnection(com.timesten.jdbc.JdbcOdbcConnection conn, int maxStatements)
          Constructs an ObservableConnection object.

 

Method Summary
 void addConnectionEventListener(javax.sql.ConnectionEventListener observer)
          This method is a required part of the PooledConnection interface.
 void addStatementEventListener(javax.sql.StatementEventListener listener)
           
 void close()
          This method is a required part of the PooledConnection interface.
 java.sql.Connection getConnection()
          This method is a required part of the PooledConnection interface.
 void removeConnectionEventListener(javax.sql.ConnectionEventListener observer)
          This method is a required part of the PooledConnection interface.
 void removeStatementEventListener(javax.sql.StatementEventListener listener)
           

 

Methods inherited from class com.timesten.jdbc.JdbcOdbcObject
BytesToChars, CharsToBytes, CharsToBytes, hexPad, hexPairToInt, hexStringToByteArray, isConnectionBroken, toHex

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

ObservableConnection

public ObservableConnection(com.timesten.jdbc.JdbcOdbcConnection conn)
Constructs an ObservableConnection object. This just stores the physical connection object.
Parameters:
conn - real database connection for that is observed.

ObservableConnection

public ObservableConnection(com.timesten.jdbc.JdbcOdbcConnection conn,
                            int maxStatements)
Constructs an ObservableConnection object. This just stores the physical connection object.
Parameters:
conn - real database connection for that is observed.
maxStatements - number of pooled prepared statements

Method Detail

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
This method is a required part of the PooledConnection interface. Calls getConnectionInternal to do the real work. From an application's point of view, there is no difference between the object returned by this method and one that is returned from TimesTenDataSource.getConnection or DriverManager.getConnection. However when the application calls ProxyConnection.close the underlying physical connection is not closed.
Specified by:
getConnection in interface javax.sql.PooledConnection
Returns:
a Connection object that is a proxy object to the real connection object that this ObservableConnection object represents.
Throws:
java.sql.SQLException - if a database access error occurs.

close

public void close()
           throws java.sql.SQLException
This method is a required part of the PooledConnection interface. Closes the real underlying connection that this PooledConnection object represents.
Specified by:
close in interface javax.sql.PooledConnection
Throws:
java.sql.SQLException - if a database access error occurs

addConnectionEventListener

public void addConnectionEventListener(javax.sql.ConnectionEventListener observer)
This method is a required part of the PooledConnection interface. Registers the given event listener so that it will be notified when an event occurs on this PooledConnection object.
Specified by:
addConnectionEventListener in interface javax.sql.PooledConnection
Parameters:
observer - a component that has implemented the ConnectionEventListener interface and wants to be notified when the connection is closed or has an error; generally, a connection pool manager
See Also:
removeConnectionEventListener(javax.sql.ConnectionEventListener)

removeConnectionEventListener

public void removeConnectionEventListener(javax.sql.ConnectionEventListener observer)
This method is a required part of the PooledConnection interface. Removes the given event listener from the list of components that will be notified when an event occurs on this PooledConnection object.
Specified by:
removeConnectionEventListener in interface javax.sql.PooledConnection
Parameters:
observer - a component that has implemented the ConnectionEventListener interface and been been registered as a listener; generally, a connection pool manager
See Also:
addConnectionEventListener(javax.sql.ConnectionEventListener)

addStatementEventListener

public void addStatementEventListener(javax.sql.StatementEventListener listener)
Specified by:
addStatementEventListener in interface javax.sql.PooledConnection

removeStatementEventListener

public void removeStatementEventListener(javax.sql.StatementEventListener listener)
Specified by:
removeStatementEventListener in interface javax.sql.PooledConnection

Skip navigation links

Oracle® TimesTen In-Memory Database JDBC Extensions Java API Reference
Release 11.2.1

E13083-02


Copyright © 1999, 2010, Oracle and/or its affiliates. All rights reserved.