com.ibm.db.base
Class DatabaseConnection

java.lang.Object
  |
  +--com.ibm.db.base.DatabaseConnection

public class DatabaseConnection
extends java.lang.Object


Field Summary
private  DatabaseConnectionSpec connSpec
           
private static java.lang.String copyright
           
private  JDBCConnectionManager databaseManager
           
private  java.util.Hashtable dbSearchTypeInfo
           
private  boolean externallyManaged
           
protected  java.lang.reflect.Method getIBMJdbcConn
           
protected  java.lang.reflect.Method getJdbcConn
           
private  java.sql.Connection jdbcConnection
           
protected  java.lang.reflect.Method releaseIBMConn
           
protected  java.lang.Object websphereConnection
           
(package private)  java.lang.Class websphereJdbcConnPoolAccess
           
 
Constructor Summary
DatabaseConnection(java.sql.Connection jdbcConnection)
          Constructs a new DatabaseConnection and associates it with the provided externally managed jdbcConnection.
DatabaseConnection(JDBCConnectionManager aDatabaseManager)
          Constructs a new DatabaseConnection and associates it with a JDBCConnectionManager.
 
Method Summary
 void commitTransaction()
          Sends commit to the JDBC Connection associated with the DatabaseConnection.
 void connectToDataSource()
          Attempts to connect using the supplied logon and connection specs
 void disconnect()
          Disconnect the JDBC connection.
 java.lang.String getAlias()
          Returns the alias used to identify the connection.
 boolean getAutoCommit()
          Returns true if changes will be automatically committed.
 java.sql.DatabaseMetaData getConnectionMetaData()
          Returns the database meta data asociated with this connection.
 DatabaseConnectionSpec getConnectionSpec()
          Returns the connection spec used to create this connection.
private  java.lang.String getConnectionUrl()
          Returns the JDBC connection URL (jdbc::).
protected  JDBCConnectionManager getDatabaseManager()
          Returns the Connection Manager that holds on to this connection.
 java.sql.Connection getJdbcConnection()
          Returns the JDBCConnection held on to by this connection object.
protected  java.util.Hashtable getSearchTypeInfo()
          Returns a hashtable that contains the searchable setting for the type names for this database.
 int getTransactionIsolation()
          Returns the connection's current isolation level as an integer.
 boolean isConnected()
          Use this method to determine whether the connection to the database is open or not.
protected  void obtainWebsphereConnection()
           
protected  void releaseWebsphereConnection()
           
 void rollbackTransaction()
          Sends rollback to the JDBC Connection.
 void setAutoCommit(boolean autoCommit)
          Sets the autoCommit value in the JDBConnection.
 void setConnectionSpec(DatabaseConnectionSpec aConnectionSpec)
          Sets the connection spec used to create this connection.
protected  void setDatabaseManager(JDBCConnectionManager aDatabaseManager)
          Sets the connection manager that holds on to this connection.
protected  void setJdbcConnection(java.sql.Connection aJdbcConnection)
          Sets the JDBCConnection this connection instance wraps.
 void setTransactionIsolation(int isolation)
          Sets the transaction isolation level for the connection.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

connSpec

private DatabaseConnectionSpec connSpec

jdbcConnection

private java.sql.Connection jdbcConnection

databaseManager

private JDBCConnectionManager databaseManager

externallyManaged

private boolean externallyManaged

dbSearchTypeInfo

private transient java.util.Hashtable dbSearchTypeInfo

websphereJdbcConnPoolAccess

transient java.lang.Class websphereJdbcConnPoolAccess

getIBMJdbcConn

protected transient java.lang.reflect.Method getIBMJdbcConn

websphereConnection

protected transient java.lang.Object websphereConnection

getJdbcConn

protected transient java.lang.reflect.Method getJdbcConn

releaseIBMConn

protected transient java.lang.reflect.Method releaseIBMConn

copyright

private static final java.lang.String copyright
Constructor Detail

DatabaseConnection

public DatabaseConnection(JDBCConnectionManager aDatabaseManager)
Constructs a new DatabaseConnection and associates it with a JDBCConnectionManager.
Parameters:
aDatabaseManager - associated JDBCConnectionManager

DatabaseConnection

public DatabaseConnection(java.sql.Connection jdbcConnection)
                   throws java.sql.SQLException
Constructs a new DatabaseConnection and associates it with the provided externally managed jdbcConnection. The DatabaseConnection is marked as externally managed.
Parameters:
jdbcConnection - a open JDBC connection
Method Detail

commitTransaction

public void commitTransaction()
                       throws java.sql.SQLException
Sends commit to the JDBC Connection associated with the DatabaseConnection.

connectToDataSource

public void connectToDataSource()
                         throws java.sql.SQLException,
                                DataException
Attempts to connect using the supplied logon and connection specs

disconnect

public void disconnect()
                throws java.sql.SQLException,
                       DataException,
                       java.lang.NullPointerException
Disconnect the JDBC connection.

getAlias

public java.lang.String getAlias()
Returns the alias used to identify the connection.

getAutoCommit

public boolean getAutoCommit()
                      throws java.sql.SQLException
Returns true if changes will be automatically committed.

getConnectionMetaData

public java.sql.DatabaseMetaData getConnectionMetaData()
                                                throws java.sql.SQLException
Returns the database meta data asociated with this connection.

getConnectionSpec

public DatabaseConnectionSpec getConnectionSpec()
Returns the connection spec used to create this connection.

getConnectionUrl

private java.lang.String getConnectionUrl()
Returns the JDBC connection URL (jdbc::).

getDatabaseManager

protected JDBCConnectionManager getDatabaseManager()
Returns the Connection Manager that holds on to this connection.

getJdbcConnection

public java.sql.Connection getJdbcConnection()
Returns the JDBCConnection held on to by this connection object.

getSearchTypeInfo

protected java.util.Hashtable getSearchTypeInfo()
                                         throws java.sql.SQLException
Returns a hashtable that contains the searchable setting for the type names for this database.

getTransactionIsolation

public int getTransactionIsolation()
                            throws java.sql.SQLException
Returns the connection's current isolation level as an integer.

isConnected

public boolean isConnected()
                    throws java.sql.SQLException
Use this method to determine whether the connection to the database is open or not.
Returns:
true if the connection to the database is open, false otherwise

obtainWebsphereConnection

protected void obtainWebsphereConnection()
                                  throws DataException

releaseWebsphereConnection

protected void releaseWebsphereConnection()
                                   throws DataException

rollbackTransaction

public void rollbackTransaction()
                         throws java.sql.SQLException
Sends rollback to the JDBC Connection.

setAutoCommit

public void setAutoCommit(boolean autoCommit)
                   throws java.sql.SQLException
Sets the autoCommit value in the JDBConnection.

setConnectionSpec

public void setConnectionSpec(DatabaseConnectionSpec aConnectionSpec)
Sets the connection spec used to create this connection.

setDatabaseManager

protected void setDatabaseManager(JDBCConnectionManager aDatabaseManager)
Sets the connection manager that holds on to this connection.

setJdbcConnection

protected void setJdbcConnection(java.sql.Connection aJdbcConnection)
Sets the JDBCConnection this connection instance wraps.

setTransactionIsolation

public void setTransactionIsolation(int isolation)
                             throws java.sql.SQLException
Sets the transaction isolation level for the connection.