Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.iapi.jdbc
Class BrokeredConnection  view BrokeredConnection download BrokeredConnection.java

java.lang.Object
  extended byorg.apache.derby.iapi.jdbc.BrokeredConnection
All Implemented Interfaces:
java.sql.Connection
Direct Known Subclasses:
BrokeredConnection30

public class BrokeredConnection
extends java.lang.Object
implements java.sql.Connection

This is a rudimentary connection that delegates EVERYTHING to Connection.


Field Summary
protected  BrokeredConnectionControl control
           
private  boolean isClosed
           
private  boolean stateAutoCommit
           
protected  int stateHoldability
           
private  int stateIsolationLevel
          Maintain state as seen by this Connection handle, not the state of the underlying Connection it is attached to.
private  boolean stateReadOnly
           
 
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
Constructor Summary
BrokeredConnection(BrokeredConnectionControl control)
           
 
Method Summary
 void clearWarnings()
          This method clears all warnings that have occurred on this connection.
 void close()
          This method immediately closes this database connection.
 void commit()
          This method commits any SQL statements executed on this connection since the last commit or rollback.
 java.sql.Statement createStatement()
          This method creates a new SQL statement.
 java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency)
          This method creates a new SQL statement with the specified type and concurrency.
 boolean getAutoCommit()
          This method tests whether or not auto commit mode is currently enabled.
 java.lang.String getCatalog()
          This method returns the name of the catalog in use by this connection, if any.
protected  int getJDBCLevel()
           
 java.sql.DatabaseMetaData getMetaData()
          This method returns the meta data for this database connection.
 int getPrepareIsolation()
          get the isolation level that is currently being used to prepare statements (used for network server)
protected  java.sql.Connection getRealConnection()
          A little indirection for getting the real connection.
 int getTransactionIsolation()
          This method returns the current transaction isolation mode.
 java.util.Map getTypeMap()
          This method returns the mapping of SQL types to Java classes currently in use by this connection.
 java.sql.SQLWarning getWarnings()
          This method returns the first warning that occurred on this connection, if any.
 boolean isClosed()
          This method tests whether or not this connection has been closed.
 boolean isReadOnly()
          This method tests whether or not this connection is in read only mode.
 java.lang.String nativeSQL(java.lang.String sql)
          This method converts the specified generic SQL statement into the native grammer of the database this object is connected to.
 BrokeredStatement newBrokeredStatement(BrokeredStatementControl statementControl)
           
 BrokeredCallableStatement newBrokeredStatement(BrokeredStatementControl statementControl, java.lang.String sql)
           
 BrokeredPreparedStatement newBrokeredStatement(BrokeredStatementControl statementControl, java.lang.String sql, java.lang.Object generatedKeys)
           
protected  void notifyException(java.sql.SQLException sqle)
           
 java.sql.CallableStatement prepareCall(java.lang.String sql)
          This method creates a new CallableStatement for the specified SQL string.
 java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)
          This method creates a new CallableStatement for the specified SQL string.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql)
          This method creates a new PreparedStatement for the specified SQL string.
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)
          This method creates a new PreparedStatement for the specified SQL string.
 void rollback()
          This method rolls back any SQL statements executed on this connection since the last commit or rollback.
 void setAutoCommit(boolean autoCommit)
          This method turns auto commit mode on or off.
 void setCatalog(java.lang.String catalog)
          This method sets the name of the catalog in use by this connection.
 void setDrdaID(java.lang.String drdaID)
          set the DrdaId for this connection.
 void setPrepareIsolation(int level)
          Set the internal isolation level to use for preparing statements.
 void setReadOnly(boolean readOnly)
          This method turns read only mode on or off.
 void setState(boolean complete)
          Set the state of the underlying connection according to the state of this connection's view of state.
 void setTransactionIsolation(int level)
          This method sets the current transaction isolation mode.
 void setTypeMap(java.util.Map map)
          This method sets the mapping table for SQL types to Java classes.
 void syncState()
          Sync up the state of the underlying connection with the state of this new handle.
 java.lang.String toString()
          Get the string representation for the underlying physical connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.sql.Connection
createStatement, getHoldability, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, setHoldability, setSavepoint, setSavepoint
 

Field Detail

stateHoldability

protected int stateHoldability

control

protected final BrokeredConnectionControl control

isClosed

private boolean isClosed

stateIsolationLevel

private int stateIsolationLevel
Maintain state as seen by this Connection handle, not the state of the underlying Connection it is attached to.


stateReadOnly

private boolean stateReadOnly

stateAutoCommit

private boolean stateAutoCommit
Constructor Detail

BrokeredConnection

public BrokeredConnection(BrokeredConnectionControl control)
Method Detail

setAutoCommit

public final void setAutoCommit(boolean autoCommit)
                         throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method turns auto commit mode on or off. In auto commit mode, every SQL statement is committed its own transaction. Otherwise a transaction must be explicitly committed or rolled back.

Specified by:
setAutoCommit in interface java.sql.Connection

getAutoCommit

public final boolean getAutoCommit()
                            throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method tests whether or not auto commit mode is currently enabled. In auto commit mode, every SQL statement is committed its own transaction. Otherwise a transaction must be explicitly committed or rolled back.

Specified by:
getAutoCommit in interface java.sql.Connection

createStatement

public final java.sql.Statement createStatement()
                                         throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method creates a new SQL statement. The default result set type and concurrency will be used.

Specified by:
createStatement in interface java.sql.Connection

prepareStatement

public final java.sql.PreparedStatement prepareStatement(java.lang.String sql)
                                                  throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method creates a new PreparedStatement for the specified SQL string. This method is designed for use with parameterized statements. The default result set type and concurrency will be used.

Specified by:
prepareStatement in interface java.sql.Connection

prepareCall

public final java.sql.CallableStatement prepareCall(java.lang.String sql)
                                             throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method creates a new CallableStatement for the specified SQL string. Thie method is designed to be used with stored procedures. The default result set type and concurrency will be used.

Specified by:
prepareCall in interface java.sql.Connection

nativeSQL

public final java.lang.String nativeSQL(java.lang.String sql)
                                 throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method converts the specified generic SQL statement into the native grammer of the database this object is connected to.

Specified by:
nativeSQL in interface java.sql.Connection

commit

public final void commit()
                  throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method commits any SQL statements executed on this connection since the last commit or rollback.

Specified by:
commit in interface java.sql.Connection

rollback

public final void rollback()
                    throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method rolls back any SQL statements executed on this connection since the last commit or rollback.

Specified by:
rollback in interface java.sql.Connection

close

public final void close()
                 throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method immediately closes this database connection.

Specified by:
close in interface java.sql.Connection

isClosed

public final boolean isClosed()
                       throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method tests whether or not this connection has been closed.

Specified by:
isClosed in interface java.sql.Connection

getWarnings

public final java.sql.SQLWarning getWarnings()
                                      throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method returns the first warning that occurred on this connection, if any. If there were any subsequence warnings, they will be chained to the first one.

Specified by:
getWarnings in interface java.sql.Connection

clearWarnings

public final void clearWarnings()
                         throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method clears all warnings that have occurred on this connection.

Specified by:
clearWarnings in interface java.sql.Connection

getMetaData

public final java.sql.DatabaseMetaData getMetaData()
                                            throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method returns the meta data for this database connection.

Specified by:
getMetaData in interface java.sql.Connection

setReadOnly

public final void setReadOnly(boolean readOnly)
                       throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method turns read only mode on or off. It may not be called while a transaction is in progress.

Specified by:
setReadOnly in interface java.sql.Connection

isReadOnly

public final boolean isReadOnly()
                         throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method tests whether or not this connection is in read only mode.

Specified by:
isReadOnly in interface java.sql.Connection

setCatalog

public final void setCatalog(java.lang.String catalog)
                      throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method sets the name of the catalog in use by this connection. Note that this method does nothing if catalogs are not supported by this database.

Specified by:
setCatalog in interface java.sql.Connection

getCatalog

public final java.lang.String getCatalog()
                                  throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method returns the name of the catalog in use by this connection, if any.

Specified by:
getCatalog in interface java.sql.Connection

setTransactionIsolation

public final void setTransactionIsolation(int level)
                                   throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method sets the current transaction isolation mode. This must be one of the constants defined in this interface.

Specified by:
setTransactionIsolation in interface java.sql.Connection

getTransactionIsolation

public final int getTransactionIsolation()
                                  throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method returns the current transaction isolation mode. This will be one of the constants defined in this interface.

Specified by:
getTransactionIsolation in interface java.sql.Connection

createStatement

public final java.sql.Statement createStatement(int resultSetType,
                                                int resultSetConcurrency)
                                         throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method creates a new SQL statement with the specified type and concurrency. Valid values for these parameters are specified in the ResultSet class.

Specified by:
createStatement in interface java.sql.Connection

prepareStatement

public final java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                         int resultSetType,
                                                         int resultSetConcurrency)
                                                  throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method creates a new PreparedStatement for the specified SQL string. This method is designed for use with parameterized statements. The specified result set type and concurrency will be used. Valid values for these parameters are specified in the ResultSet class.

Specified by:
prepareStatement in interface java.sql.Connection

prepareCall

public final java.sql.CallableStatement prepareCall(java.lang.String sql,
                                                    int resultSetType,
                                                    int resultSetConcurrency)
                                             throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method creates a new CallableStatement for the specified SQL string. Thie method is designed to be used with stored procedures. The specified result set type and concurrency will be used. Valid values for these parameters are specified in the ResultSet class.

Specified by:
prepareCall in interface java.sql.Connection

getTypeMap

public final java.util.Map getTypeMap()
                               throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method returns the mapping of SQL types to Java classes currently in use by this connection. This mapping will have no entries unless they have been manually added.

Specified by:
getTypeMap in interface java.sql.Connection

setTypeMap

public final void setTypeMap(java.util.Map map)
                      throws java.sql.SQLException
Description copied from interface: java.sql.Connection
This method sets the mapping table for SQL types to Java classes. Any entries in this map override the defaults.

Specified by:
setTypeMap in interface java.sql.Connection

getRealConnection

protected final java.sql.Connection getRealConnection()
                                               throws java.sql.SQLException
A little indirection for getting the real connection.


notifyException

protected final void notifyException(java.sql.SQLException sqle)

syncState

public void syncState()
               throws java.sql.SQLException
Sync up the state of the underlying connection with the state of this new handle.


setState

public void setState(boolean complete)
              throws java.sql.SQLException
Set the state of the underlying connection according to the state of this connection's view of state.


newBrokeredStatement

public BrokeredStatement newBrokeredStatement(BrokeredStatementControl statementControl)
                                       throws java.sql.SQLException

newBrokeredStatement

public BrokeredPreparedStatement newBrokeredStatement(BrokeredStatementControl statementControl,
                                                      java.lang.String sql,
                                                      java.lang.Object generatedKeys)
                                               throws java.sql.SQLException

newBrokeredStatement

public BrokeredCallableStatement newBrokeredStatement(BrokeredStatementControl statementControl,
                                                      java.lang.String sql)
                                               throws java.sql.SQLException

setDrdaID

public void setDrdaID(java.lang.String drdaID)
set the DrdaId for this connection. The drdaID prints with the statement text to the errror log


setPrepareIsolation

public void setPrepareIsolation(int level)
                         throws java.sql.SQLException
Set the internal isolation level to use for preparing statements. Subsequent prepares will use this isoalation level


getPrepareIsolation

public int getPrepareIsolation()
                        throws java.sql.SQLException
get the isolation level that is currently being used to prepare statements (used for network server)


toString

public java.lang.String toString()
Get the string representation for the underlying physical connection. When a physical connection is created, it is assigned a unique id that is unchanged for the lifetime of the connection. When an application calls Connection.toString(), it gets the string representation of the underlying physical connection, regardless of whether the application has a reference to the physical connection itself or a reference to a proxy connection (aka brokered connection) that wraps the physical connection. Since this BrokeredConnection is a proxy connection, we return the string value of its underlying physical connection


getJDBCLevel

protected int getJDBCLevel()