All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class oracle.jdbc.driver.OracleConnection

java.lang.Object
   |
   +----oracle.jdbc.driver.OracleConnection

public class OracleConnection
extends Object
implements Connection, ClientDataSupport
The OracleConnection class implements the JDBC 1.0 Connection interface.

The implementation relies on native methods. The native methods do all the work and return error codes, a return value >= 0 means the call was successful. The Java methods call the native methods, check the error codes and raise exceptions if errors occured. If the native method get_error_message returns a string that can be used to explain the error to the user.


Variable Index

 o ASCII_TO_CHAR
 o CHAR_TO_ASCII
 o CHAR_TO_JAVACHAR
 o CHAR_TO_UNICODE
 o conversion
 o db_access
 o DEBUG
 o JAVACHAR_TO_CHAR
 o NONE
 o RAW_TO_ASCII
 o RAW_TO_JAVACHAR
 o RAW_TO_UNICODE
 o UNICODE_TO_CHAR
 o UsingXA
 o XA_wants_error

Constructor Index

 o OracleConnection(DBAccess, String, String, String, String, Properties)
Allocate a new OracleConnection.
 o OracleConnection(OraclePooledConnection, OracleConnection, boolean)

Method Index

 o archive(int, int, String)
 o clearWarnings()
We do not have any connection-level warnings
 o close()
Rollbacks the current transaction.
 o commit()
 o createStatement()
createStatement just allocates a new statement object.
 o createStatement(int, int)
JDBC 2.0 Creates a Statement object that will generate ResultSet objects with the given type and concurrency.
 o getAutoClose()
We are always in auto-close mode.
 o getAutoCommit()
 o getCatalog()
We do not support catalogs.
 o getClientData(Object)
Obtain the client data value associated with a key.
 o getDbCsId()
Obtain the Oracle identifier of the character set used in the database server.
 o getDefaultExecuteBatch()
Allows the user to retrieve the batch value for the connection.
 o getDefaultRowPrefetch()
Allows the user to retrieve the row prefetch value for the connection.
 o getDescriptor(String)
Return the matched StructDescriptor.
 o getFDO()
INTERNAL Get Format Descriptor Object.
 o getIncludeSynonyms()
Returns true if DatabaseMetaData.getColumns will report information if a table synonym is passed in, and false otherwise.

 o getJavaObject(String)
 o getJdbcCsId()
Obtain the Oracle identifier of the character set used in the JDBC driver.
 o getMetaData()
We just return a oracle.oci8.DatabaseMetaData object.
 o getRemarksReporting()
Return true if the DatabaseMetaData calls getTables and getColumns will report the REMARKS column.

 o getSQLType(Object)
 o getStructAttrCsId()
Obtain the Oracle identifier of the character set used in STRUCT attributes.
 o getTransactionIsolation()
We only support dirty reads.
 o getTypeMap()
 o getUserName()
 o getUsingXAFlag()
 o getWarnings()
We do not have any connection-level warnings
 o getXAErrorFlag()
 o holdLine(OracleStatement)
 o initUserName()
 o isClosed()
As we do not keep a state in the Java struct we call native method even for isClosed.
 o isReadOnly()
Our connections are never in read-only mode.
 o nativeSQL(String)
This is a bogus and quickly done implementation waiting for something better
 o needLine()
 o prepareCall(String)
This is similar to createStatement.
 o prepareCall(String, int, int)
JDBC 2.0 Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency.
 o prepareStatement(String)
This is similar to createStatement.
 o prepareStatement(String, int, int)
JDBC 2.0 Creates a PreparedStatement object that will generate ResultSet objects with the given type and concurrency.
 o putDescriptor(String, Object)
Store the Object Descriptor for later usage.
 o registerSQLType(String, Class)
 o registerSQLType(String, String)
Map accessor methods
 o releaseLine()
 o removeClientData(Object)
Remove the specified key and any associated client data.
 o rollback()
 o setAutoClose(boolean)
We are always in auto-close mode.
 o setAutoCommit(boolean)
 o setCatalog(String)
We do not support catalogs.
 o setClientData(Object, Object)
Store a piece client data and associate it with the specified key.
 o setDefaultExecuteBatch(int)
Set the batch value for executes for all prepared statements belonging to this connection and created after the batch value was set.
 o setDefaultRowPrefetch(int)
Set the value of row prefetch for all statements associated with this connection and created after this value was set.
 o setIncludeSynonyms(boolean)
Turn on or off retrieval of synonym information in DatabaseMetaData.
 o setReadOnly(boolean)
We do not support read-only connections
 o setRemarksReporting(boolean)
Turn on or off the reporting of the REMARKS columns by the getTables and getColumns calls of the DatabaseMetaData interface.

The DatabaseMetaData calls getTables and getColumns are extremely slow if the REMARKS column has to be reported as this necessitates an expensive outer join so by default the JDBC driver does not report the REMARKS columns.

You can turn the reporting of REMARKS on by passing a true argument to this method.

 o setTransactionIsolation(int)
We only support dirty reads.
 o setTypeMap(Dictionary)
 o setUsingXAFlag(boolean)
 o setXAErrorFlag(boolean)
 o shutdown(int)
 o startup(String, int)
 o trace(String)

Variables

 o DEBUG
 public static final boolean DEBUG
 o db_access
 public DBAccess db_access
 o conversion
 public DBConversion conversion
 o XA_wants_error
 public boolean XA_wants_error
 o UsingXA
 public boolean UsingXA
 o CHAR_TO_ASCII
 public static final int CHAR_TO_ASCII
 o CHAR_TO_UNICODE
 public static final int CHAR_TO_UNICODE
 o RAW_TO_ASCII
 public static final int RAW_TO_ASCII
 o RAW_TO_UNICODE
 public static final int RAW_TO_UNICODE
 o UNICODE_TO_CHAR
 public static final int UNICODE_TO_CHAR
 o ASCII_TO_CHAR
 public static final int ASCII_TO_CHAR
 o NONE
 public static final int NONE
 o JAVACHAR_TO_CHAR
 public static final int JAVACHAR_TO_CHAR
 o RAW_TO_JAVACHAR
 public static final int RAW_TO_JAVACHAR
 o CHAR_TO_JAVACHAR
 public static final int CHAR_TO_JAVACHAR

Constructors

 o OracleConnection
 public OracleConnection(DBAccess access,
                         String ur,
                         String us,
                         String p,
                         String db,
                         Properties info) throws SQLException
Allocate a new OracleConnection. We get the connection parameters as arguments.

We allocate the c_state and call the native method "connect" that does the work. If connect fails we raise an exception.

See Also:
connect
 o OracleConnection
 public OracleConnection(OraclePooledConnection par,
                         OracleConnection pc,
                         boolean autoCommit) throws SQLException

Methods

 o createStatement
 public synchronized Statement createStatement() throws SQLException
createStatement just allocates a new statement object. The statement has a pointer to the connection object.

Returns:
a new OracleStatement object
 o prepareStatement
 public synchronized PreparedStatement prepareStatement(String sql) throws SQLException
This is similar to createStatement. We accept both ODBC syntax and Oracle syntax for SQL statements.

Returns:
a new OraclePreparedStatement object
 o prepareCall
 public synchronized CallableStatement prepareCall(String sql) throws SQLException
This is similar to createStatement. We accept both ODBC syntax and Oracle syntax for SQL statements.

Returns:
a new oracle.jdbc.driver.CallableStatement object
 o nativeSQL
 public String nativeSQL(String sql) throws SQLException
This is a bogus and quickly done implementation waiting for something better

 o setAutoCommit
 public synchronized void setAutoCommit(boolean autoCommit) throws SQLException
 o getAutoCommit
 public synchronized boolean getAutoCommit() throws SQLException
 o commit
 public synchronized void commit() throws SQLException
 o rollback
 public synchronized void rollback() throws SQLException
 o close
 public synchronized void close() throws SQLException
Rollbacks the current transaction. See commit for discussion of how the PreparedStatements, CallableStatement and ResultSets are closed.

See Also:
rollback, commit
 o isClosed
 public synchronized boolean isClosed() throws SQLException
As we do not keep a state in the Java struct we call native method even for isClosed. (The alternative is to test if c_state is 0, but this breaks the information hiding strategy.)

 o getMetaData
 public synchronized DatabaseMetaData getMetaData() throws SQLException
We just return a oracle.oci8.DatabaseMetaData object. It has a pointer to the connection.

 o setReadOnly
 public void setReadOnly(boolean readOnly) throws SQLException
We do not support read-only connections

 o isReadOnly
 public boolean isReadOnly() throws SQLException
Our connections are never in read-only mode.

 o setCatalog
 public void setCatalog(String catalog) throws SQLException
We do not support catalogs.

 o getCatalog
 public String getCatalog() throws SQLException
We do not support catalogs.

 o setTransactionIsolation
 public synchronized void setTransactionIsolation(int level) throws SQLException
We only support dirty reads.

 o getTransactionIsolation
 public int getTransactionIsolation() throws SQLException
We only support dirty reads.

 o setAutoClose
 public synchronized void setAutoClose(boolean autoClose) throws SQLException
We are always in auto-close mode.

 o getAutoClose
 public boolean getAutoClose() throws SQLException
We are always in auto-close mode.

 o getWarnings
 public SQLWarning getWarnings() throws SQLException
We do not have any connection-level warnings

 o clearWarnings
 public void clearWarnings() throws SQLException
We do not have any connection-level warnings

 o trace
 public void trace(String s)
 o setDefaultRowPrefetch
 public synchronized void setDefaultRowPrefetch(int value) throws SQLException
Set the value of row prefetch for all statements associated with this connection and created after this value was set.

If this value is not set by the user, only 1 row will be fetched at a time.

All statements created before this API was called will have a row prefetch of 1.

Row prefetching allows the JDBC driver to "fetch" multiple rows in one round-trip to the database. If this value is not set by the user, only 1 row will be fetched at a time.

To use the setDefaultRowPrefetch entrypoint you have to cast the Statement object to the type oracle.jdbc.driver.OracleConnection.

The user can override the row prefetch value set by this oracle.jdbc.driver.OracleConnection entrypoint for individual statements, by calling OracleStatement.setRowPrefetch for those statements.

The row_prefetch will be turned back to 1 automatically by the driver if any of the select-column types is streaming (long data or long raw data). This is overrides any value the user might set. Also, this will be done regardless of wether the streaming columns are read or not.

To use the setDefaultRowPrefetch entrypoint you have to cast the Connection object to the type oracle.jdbc.driver.OracleConnection.

See Also:
setRowPrefetch, getDefaultRowPrefetch
 o getDefaultRowPrefetch
 public synchronized int getDefaultRowPrefetch()
Allows the user to retrieve the row prefetch value for the connection.

The row prefetch from the connection is used for all statements associated with this connection. However, the user can also define a different row prefetch value for each statement. This can be done using Oraclestatement.setRowPrefetch, which will override the default value provided from the connection. Therefore, the row prefetch value returned by this getDefaultRowPrefetch entrypoint is valid for statements for which the user has not defined a different row prefetch.

To use the setDefaultRowPrefetch entrypoint you have to cast the Connection object to the type oracle.jdbc.driver.OracleConnection.

See Also:
setRowPrefetch, setDefaultRowPrefetch
 o setDefaultExecuteBatch
 public synchronized void setDefaultExecuteBatch(int batch) throws SQLException
Set the batch value for executes for all prepared statements belonging to this connection and created after the batch value was set.

All statements created before using this API to set the batch value will have a batch value of 1.

Batching allows the JDBC driver to avoid making one round-trip to the RDBMS to execute a prepared statement every time bind variables change. The driver "batches" multiple executions of the statement with different bind variables. Actual execution normally happens when the number of executions reaches the pre-defined "batch" value. The set of bind variables along with the number of times the statement needs to be executed (equal to "batch"), are sent to the RDBMS in one round-trip.

To use the setDefaultExecuteBatch entrypoint you have to cast the Connection object to the type oracle.jdbc.driver.OracleConnection.

The user can override the batch value set by this setDefaultExecuteBatch entrypoint for individual prepared statements, by calling OraclePreparedStatement.setExecuteBatch for those statements.

The default value of batch will be overridden by the driver for a particular statement if that statement has any streaming bind values.

See Also:
setRowPrefetch, getDefaultRowPrefetch
 o getDefaultExecuteBatch
 public synchronized int getDefaultExecuteBatch()
Allows the user to retrieve the batch value for the connection.

The batch value from the connection is used for all prepared statements associated with this connection. However, the user can also define a different batch value for individual prepared statements. This can be done by using OraclePreparedStatement.setExecuteBatch, which will override the default value provided from the connection. Therefore, the row prefetch value returned by this getDefaultExecuteBatch entrypoint is valid for prepared statements for which the user has not defined a different batch value.

To use the getDefaultExecuteBatch entrypoint you have to cast the Connection object to the type oracle.jdbc.driver.OracleConnection.

See Also:
setRowPrefetch, setDefaultRowPrefetch
 o setRemarksReporting
 public synchronized void setRemarksReporting(boolean reportRemarks)
Turn on or off the reporting of the REMARKS columns by the getTables and getColumns calls of the DatabaseMetaData interface.

The DatabaseMetaData calls getTables and getColumns are extremely slow if the REMARKS column has to be reported as this necessitates an expensive outer join so by default the JDBC driver does not report the REMARKS columns.

You can turn the reporting of REMARKS on by passing a true argument to this method. You turn it back off by passing a false argument.

You can also control the reporting of REMARKS by passing a property named "remarksReporting" as "true" to the DriverManager.getConnection call.

 o getRemarksReporting
 public synchronized boolean getRemarksReporting()
Return true if the DatabaseMetaData calls getTables and getColumns will report the REMARKS column.

 o setIncludeSynonyms
 public void setIncludeSynonyms(boolean synonyms)
Turn on or off retrieval of synonym information in DatabaseMetaData. getColumns.

Similar to setRemarksReporting, getColumns performs extremely slow if information about synonyms has to be included, because it neccessitates an outer join. By default, the JDBC driver will not report information about table columns when you pass a synonym to getColumns.

You can get synonym information by passing true to this method, and turn it off by passing false. You can also control this behavior by passing a property named "includeSynonyms" as "true" to DriverManager.getConnection.

 o getIncludeSynonyms
 public boolean getIncludeSynonyms()
Returns true if DatabaseMetaData.getColumns will report information if a table synonym is passed in, and false otherwise.

 o needLine
 public synchronized void needLine() throws SQLException
 o holdLine
 public synchronized void holdLine(OracleStatement stmt)
 o releaseLine
 public synchronized void releaseLine()
 o startup
 public synchronized void startup(String startup_str,
                                  int mode) throws SQLException
 o shutdown
 public synchronized void shutdown(int mode) throws SQLException
 o archive
 public synchronized void archive(int mode,
                                  int aseq,
                                  String acstext) throws SQLException
 o registerSQLType
 public synchronized void registerSQLType(String sql_name,
                                          String java_class_name) throws SQLException
Map accessor methods

 o registerSQLType
 public synchronized void registerSQLType(String sql_name,
                                          Class java_class) throws SQLException
 o getSQLType
 public synchronized String getSQLType(Object obj) throws SQLException
 o getJavaObject
 public synchronized Object getJavaObject(String sql_name) throws SQLException
 o putDescriptor
 public synchronized void putDescriptor(String sql_name,
                                        Object desc) throws SQLException
Store the Object Descriptor for later usage.

 o getDescriptor
 public synchronized Object getDescriptor(String sql_name)
Return the matched StructDescriptor.

 o getJdbcCsId
 public short getJdbcCsId() throws SQLException
Obtain the Oracle identifier of the character set used in the JDBC driver.

Returns:
the Oracle identifier of the character set. See oracle.sql.CharacterSet for the set of constants defined for the identifiers.
 o getDbCsId
 public short getDbCsId() throws SQLException
Obtain the Oracle identifier of the character set used in the database server.

Returns:
the Oracle identifier of the character set. See oracle.sql.CharacterSet for the set of constants defined for the identifiers.
 o getStructAttrCsId
 public synchronized short getStructAttrCsId() throws SQLException
Obtain the Oracle identifier of the character set used in STRUCT attributes. Note that TTC always send structure attributes in the database character set.

Returns:
the Oracle identifier of the character set. See oracle.sql.CharacterSet for the set of constants defined for the identifiers.
 o createStatement
 public synchronized Statement createStatement(int resultSetType,
                                               int resultSetConcurrency) throws SQLException
JDBC 2.0 Creates a Statement object that will generate ResultSet objects with the given type and concurrency. This method is the same as the createStatement method above, but it allows the default result set type and result set concurrency type to be overridden.

Parameters:
resultSetType - a result set type; see ResultSet.TYPE_XXX
Returns:
a new Statement object
Throws: SQLException
if a database access error occurs
 o prepareStatement
 public synchronized PreparedStatement prepareStatement(String sql,
                                                        int resultSetType,
                                                        int resultSetConcurrency) throws SQLException
JDBC 2.0 Creates a PreparedStatement object that will generate ResultSet objects with the given type and concurrency. This method is the same as the prepareStatement method above, but it allows the default result set type and result set concurrency type to be overridden.

Parameters:
resultSetType - a result set type; see ResultSet.TYPE_XXX
resultSetConcurrency - a concurrency type; see ResultSet.CONCUR_XXX
Returns:
a new PreparedStatement object containing the pre-compiled SQL statement
Throws: SQLException
if a database access error occurs
 o prepareCall
 public synchronized CallableStatement prepareCall(String sql,
                                                   int resultSetType,
                                                   int resultSetConcurrency) throws SQLException
JDBC 2.0 Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency. This method is the same as the prepareCall method above, but it allows the default result set type and result set concurrency type to be overridden.

Parameters:
resultSetType - a result set type; see ResultSet.TYPE_XXX
resultSetConcurrency - a concurrency type; see ResultSet.CONCUR_XXX
Returns:
a new CallableStatement object containing the pre-compiled SQL statement
Throws: SQLException
if a database access error occurs
 o getTypeMap
 public synchronized Dictionary getTypeMap()
 o setTypeMap
 public synchronized void setTypeMap(Dictionary map)
 o setUsingXAFlag
 public void setUsingXAFlag(boolean value)
 o getUsingXAFlag
 public boolean getUsingXAFlag()
 o setXAErrorFlag
 public synchronized void setXAErrorFlag(boolean value)
 o getXAErrorFlag
 public synchronized boolean getXAErrorFlag()
 o initUserName
 public synchronized void initUserName() throws SQLException
 o getUserName
 public synchronized String getUserName() throws SQLException
 o getFDO
 public synchronized byte[] getFDO() throws SQLException
INTERNAL Get Format Descriptor Object. (INTERNAL)

 o getClientData
 public synchronized Object getClientData(Object key)
Obtain the client data value associated with a key.

Parameters:
key key - whose associated value is to be returned.
Returns:
value associated with the specified key, or null if there is no value for this key.
Throws: NullPointerException
if the specified key is null.
 o setClientData
 public synchronized Object setClientData(Object key,
                                          Object value)
Store a piece client data and associate it with the specified key. Neither the key nor the value can be null. If the specified key already existed, the old value is replaced.

Parameters:
key key - with which the specified client data value is to be associated.
value client - data value to be associated with the specified key.
Returns:
previous client data value associated with specified key, or null if there was no previous association.
Throws: NullPointerException
if the specified key or value is null.
 o removeClientData
 public synchronized Object removeClientData(Object key)
Remove the specified key and any associated client data.

Parameters:
key key - to be removed along with its associated value
Returns:
client data value being removed, or null if there was no data found.
Throws: NullPointerException
if the specified key is null.

All Packages  Class Hierarchy  This Package  Previous  Next  Index