|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--oracle.jdbc.driver.OracleConnection
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.
| Field Summary | |
static int |
ASCII_TO_CHAR
|
static int |
CHAR_TO_ASCII
|
static int |
CHAR_TO_JAVACHAR
|
static int |
CHAR_TO_UNICODE
|
oracle.jdbc.dbaccess.DBConversion |
conversion
|
oracle.jdbc.dbaccess.DBAccess |
db_access
|
static boolean |
DEBUG
|
static int |
JAVACHAR_TO_CHAR
|
oracle.sql.LobDBAccessImpl |
lob_dbaccess
|
static int |
NONE
|
static int |
RAW_TO_ASCII
|
static int |
RAW_TO_JAVACHAR
|
static int |
RAW_TO_UNICODE
|
static int |
UNICODE_TO_CHAR
|
boolean |
UsingXA
|
boolean |
XA_wants_error
|
| Constructor Summary | |
OracleConnection(oracle.jdbc.dbaccess.DBAccess access,
java.lang.String ur,
java.lang.String us,
java.lang.String p,
java.lang.String db,
java.util.Properties info)
Allocate a new OracleConnection. |
|
| Method Summary | |
void |
archive(int mode,
int aseq,
java.lang.String acstext)
|
void |
clearWarnings()
|
void |
close()
Rollbacks the current transaction. |
void |
commit()
|
oracle.sql.BfileDBAccess |
createBfileDBAccess()
|
oracle.sql.BlobDBAccess |
createBlobDBAccess()
|
oracle.sql.ClobDBAccess |
createClobDBAccess()
|
java.sql.Statement |
createStatement()
createStatement just allocates a new statement object. |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
JDBC 2.0 Creates a Statement object that will generate
ResultSet objects with the given type and concurrency. |
java.sql.Statement |
createStatementWithKey(java.lang.String key)
This is same as createStatement, except if a Statement with the given KEY exists in the Cache, then the statement is returned AS IT IS when it was closed and cached with this KEY. |
boolean |
getAutoClose()
We are always in auto-close mode. |
boolean |
getAutoCommit()
|
java.lang.String |
getCatalog()
We do not support catalogs. |
java.lang.Object |
getClientData(java.lang.Object key)
Obtain the client data value associated with a key. |
java.lang.String |
getDatabaseProductVersion()
What's the version of this database product? |
short |
getDbCsId()
Obtain the Oracle identifier of the character set used in the database server. |
boolean |
getDefaultAutoRefetch()
Oracle extension. |
int |
getDefaultExecuteBatch()
Allows the user to retrieve the batch value for the connection. |
int |
getDefaultRowPrefetch()
Allows the user to retrieve the row prefetch value for the connection. |
java.lang.Object |
getDescriptor(java.lang.String sql_name)
Return the matched StructDescriptor. |
boolean |
getIncludeSynonyms()
Returns true if DatabaseMetaData.getColumns will report information if a table synonym is passed in, and false otherwise. |
java.lang.Object |
getJavaObject(java.lang.String sql_name)
|
short |
getJdbcCsId()
Obtain the Oracle identifier of the character set used in the JDBC driver. |
java.sql.DatabaseMetaData |
getMetaData()
We just return a oracle.oci8.DatabaseMetaData object. |
boolean |
getRemarksReporting()
Return true if the DatabaseMetaData calls getTables and getColumns will report the REMARKS column. |
boolean |
getReportRemarks()
|
boolean |
getRestrictGetTables()
Returns true if the information returned by DatabaseMetaData.getTables is restricted, and false otherwise. |
java.lang.String |
getSQLType(java.lang.Object obj)
|
int |
getStmtCacheSize()
Return the size of Statement Cache. |
short |
getStructAttrCsId()
Obtain the Oracle identifier of the character set used in STRUCT attributes. |
int |
getTransactionIsolation()
We only support dirty reads. |
java.util.Dictionary |
getTypeMap()
|
java.lang.String |
getUserName()
|
boolean |
getUsingXAFlag()
|
short |
getVersionNumber()
|
java.sql.SQLWarning |
getWarnings()
Return the current warning, if any |
boolean |
getXAErrorFlag()
|
void |
holdLine(OracleStatement stmt)
|
void |
initUserName()
|
boolean |
isClosed()
As we do not keep a state in the Java struct we call native method even for isClosed. |
boolean |
isReadOnly()
Our connections are never in read-only mode. |
java.lang.String |
nativeSQL(java.lang.String sql)
This is a bogus and quickly done implementation waiting for something better |
void |
needLine()
|
java.sql.CallableStatement |
prepareCall(java.lang.String sql)
This is similar to createStatement. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
JDBC 2.0 Creates a CallableStatement object that will generate
ResultSet objects with the given type and concurrency. |
java.sql.CallableStatement |
prepareCallWithKey(java.lang.String key)
This is same as prepareCall, except if a Callable Statement with the given KEY exists in the Cache, then the statement is returned AS IT IS when it was closed and cached with this KEY. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
This is similar to createStatement. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
JDBC 2.0 Creates a PreparedStatement object that will generate
ResultSet objects with the given type and concurrency. |
java.sql.PreparedStatement |
prepareStatementWithKey(java.lang.String key)
This is same as prepareStatement, except if a Prepared Statement with the given KEY exists in the Cache, then the statement is returned AS IT IS when it was closed and cached with this KEY. |
void |
putDescriptor(java.lang.String sql_name,
java.lang.Object desc)
Store the Object Descriptor for later usage. |
void |
registerSQLType(java.lang.String sql_name,
java.lang.Class java_class)
|
void |
registerSQLType(java.lang.String sql_name,
java.lang.String java_class_name)
Map accessor methods |
void |
releaseLine()
|
java.lang.Object |
removeClientData(java.lang.Object key)
Remove the specified key and any associated client data. |
void |
rollback()
|
void |
setAutoClose(boolean autoClose)
We are always in auto-close mode. |
void |
setAutoCommit(boolean autoCommit)
|
void |
setCatalog(java.lang.String catalog)
We do not support catalogs. |
java.lang.Object |
setClientData(java.lang.Object key,
java.lang.Object value)
Store a piece client data and associate it with the specified key. |
void |
setDefaultAutoRefetch(boolean autoRefetch)
Oracle extension. |
void |
setDefaultExecuteBatch(int batch)
Set the batch value for executes for all prepared statements belonging to this connection and created after the batch value was set. |
void |
setDefaultRowPrefetch(int value)
Set the value of row prefetch for all statements associated with this connection and created after this value was set. |
void |
setIncludeSynonyms(boolean synonyms)
Turn on or off retrieval of synonym information in DatabaseMetaData. |
void |
setReadOnly(boolean readOnly)
We do not support read-only connections |
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. |
void |
setRestrictGetTables(boolean restrict)
Turn on or off the restriction of the returned data in DatabaseMetaData. |
void |
setStmtCacheSize(int size)
Set the statement cache size. |
void |
setStmtCacheSize(int size,
boolean clearMetaData)
Set the statement cache size. |
void |
setTransactionIsolation(int level)
We only support dirty reads. |
void |
setTypeMap(java.util.Dictionary map)
|
void |
setUsingXAFlag(boolean value)
|
void |
setXAErrorFlag(boolean value)
|
void |
shutdown(int mode)
|
void |
startup(java.lang.String startup_str,
int mode)
|
void |
trace(java.lang.String s)
|
| Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static final boolean DEBUG
public oracle.jdbc.dbaccess.DBAccess db_access
public oracle.jdbc.dbaccess.DBConversion conversion
public oracle.sql.LobDBAccessImpl lob_dbaccess
public boolean XA_wants_error
public boolean UsingXA
public static final int CHAR_TO_ASCII
public static final int CHAR_TO_UNICODE
public static final int RAW_TO_ASCII
public static final int RAW_TO_UNICODE
public static final int UNICODE_TO_CHAR
public static final int ASCII_TO_CHAR
public static final int NONE
public static final int JAVACHAR_TO_CHAR
public static final int RAW_TO_JAVACHAR
public static final int CHAR_TO_JAVACHAR
| Constructor Detail |
public OracleConnection(oracle.jdbc.dbaccess.DBAccess access,
java.lang.String ur,
java.lang.String us,
java.lang.String p,
java.lang.String db,
java.util.Properties info)
throws java.sql.SQLException
We allocate the c_state and call the native method "connect" that does the work. If connect fails we raise an exception.
#connect| Method Detail |
public java.sql.Statement createStatement()
throws java.sql.SQLException
public java.sql.Statement createStatement(int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
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.resultSetType - a result set type; see ResultSet.TYPE_XXX
public java.sql.Statement createStatementWithKey(java.lang.String key)
throws java.sql.SQLException
key - the key with which it was closed
public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
throws java.sql.SQLException
sql - The query for which the cursor has to be created
public java.sql.PreparedStatement prepareStatementWithKey(java.lang.String key)
throws java.sql.SQLException
key - the key with which it was closed
public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
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.sql - The query for which the cursor has to be createdresultSetType - a result set type; see ResultSet.TYPE_XXXresultSetConcurrency - a concurrency type; see ResultSet.CONCUR_XXX
public java.sql.CallableStatement prepareCall(java.lang.String sql)
throws java.sql.SQLException
sql - The query for which the cursor has to be created
public java.sql.CallableStatement prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
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.sql - The query for which the cursor has to be createdresultSetType - a result set type; see ResultSet.TYPE_XXXresultSetConcurrency - a concurrency type; see ResultSet.CONCUR_XXX
public java.sql.CallableStatement prepareCallWithKey(java.lang.String key)
throws java.sql.SQLException
key - the key with which it was closed
public java.lang.String nativeSQL(java.lang.String sql)
throws java.sql.SQLException
public void setAutoCommit(boolean autoCommit)
throws java.sql.SQLException
public boolean getAutoCommit()
throws java.sql.SQLException
public void commit()
throws java.sql.SQLException
public void rollback()
throws java.sql.SQLException
public void close()
throws java.sql.SQLException
rollback(),
commit()
public boolean isClosed()
throws java.sql.SQLException
public java.sql.DatabaseMetaData getMetaData()
throws java.sql.SQLException
public void setReadOnly(boolean readOnly)
throws java.sql.SQLException
public boolean isReadOnly()
throws java.sql.SQLException
public void setCatalog(java.lang.String catalog)
throws java.sql.SQLException
public java.lang.String getCatalog()
throws java.sql.SQLException
public void setTransactionIsolation(int level)
throws java.sql.SQLException
public int getTransactionIsolation()
throws java.sql.SQLException
public void setAutoClose(boolean autoClose)
throws java.sql.SQLException
public boolean getAutoClose()
throws java.sql.SQLException
public java.sql.SQLWarning getWarnings()
throws java.sql.SQLException
public void clearWarnings()
throws java.sql.SQLException
public void trace(java.lang.String s)
public void setDefaultRowPrefetch(int value)
throws java.sql.SQLException
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.
OracleStatement.setRowPrefetch,
getDefaultRowPrefetchpublic int getDefaultRowPrefetch()
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.
OracleStatement.setRowPrefetch,
setDefaultRowPrefetch
public void setDefaultExecuteBatch(int batch)
throws java.sql.SQLException
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.
OracleStatement.setRowPrefetch,
getDefaultRowPrefetchpublic int getDefaultExecuteBatch()
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.
OracleStatement.setRowPrefetch,
setDefaultRowPrefetchpublic void setRemarksReporting(boolean reportRemarks)
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.
public boolean getRemarksReporting()
public void setIncludeSynonyms(boolean synonyms)
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.
public boolean getIncludeSynonyms()
public void setRestrictGetTables(boolean restrict)
DatabaseMetaData.getTables will return information about all accessible tables, views, and synonyms. There are two issues relating to synonyms which can affect the quality of the returned data:
To remedy this, you can restrict the results of getTables to only those tables and views to which you have access. This is done by either passing true to this method, or by passing the "restrictGetTables" property as "true" to the DriverManager.getConnection call. The default behavior is to return information about all synonyms, including those which do not point to accessible tables or views.
Note that getTables can return more than one row for the same object, one for the object itself, and additional rows for any synonyms defined for that object. This is the case regardless of the setting for restrictGetTables.
public boolean getRestrictGetTables()
public void needLine()
throws java.sql.SQLException
public void holdLine(OracleStatement stmt)
public void releaseLine()
public void startup(java.lang.String startup_str,
int mode)
throws java.sql.SQLException
public void shutdown(int mode)
throws java.sql.SQLException
public void archive(int mode,
int aseq,
java.lang.String acstext)
throws java.sql.SQLException
public void registerSQLType(java.lang.String sql_name,
java.lang.String java_class_name)
throws java.sql.SQLException
public void registerSQLType(java.lang.String sql_name,
java.lang.Class java_class)
throws java.sql.SQLException
public java.lang.String getSQLType(java.lang.Object obj)
throws java.sql.SQLException
public java.lang.Object getJavaObject(java.lang.String sql_name)
throws java.sql.SQLException
public void putDescriptor(java.lang.String sql_name,
java.lang.Object desc)
throws java.sql.SQLException
public java.lang.Object getDescriptor(java.lang.String sql_name)
public short getJdbcCsId()
throws java.sql.SQLException
public short getDbCsId()
throws java.sql.SQLException
public short getStructAttrCsId()
throws java.sql.SQLException
public java.util.Dictionary getTypeMap()
public void setTypeMap(java.util.Dictionary map)
public void setUsingXAFlag(boolean value)
public boolean getUsingXAFlag()
public void setXAErrorFlag(boolean value)
public boolean getXAErrorFlag()
public void initUserName()
throws java.sql.SQLException
public java.lang.String getUserName()
throws java.sql.SQLException
public java.lang.Object getClientData(java.lang.Object key)
key - key whose associated value is to be returned.
public java.lang.Object setClientData(java.lang.Object key,
java.lang.Object value)
key - key with which the specified client data value is
to be associated.value - client data value to be associated with the specified
key.public java.lang.Object removeClientData(java.lang.Object key)
key - key to be removed along with its associated value
public oracle.sql.BlobDBAccess createBlobDBAccess()
throws java.sql.SQLException
public oracle.sql.ClobDBAccess createClobDBAccess()
throws java.sql.SQLException
public oracle.sql.BfileDBAccess createBfileDBAccess()
throws java.sql.SQLException
public void setStmtCacheSize(int size)
throws java.sql.SQLException
If more than
size - Size of the Cache
public void setStmtCacheSize(int size,
boolean clearMetaData)
throws java.sql.SQLException
If more than
size - Size of the CacheclearMetaData - Whether the state has to be cleared or not
public int getStmtCacheSize()
public void setDefaultAutoRefetch(boolean autoRefetch)
throws java.sql.SQLException
autoRefetch - true enables auto-refetch; false disables auto-refetch.OracleStatement.setAutoRefetch(boolean),
OracleResultSet.setAutoRefetch(boolean)
public boolean getDefaultAutoRefetch()
throws java.sql.SQLException
setDefaultAutoRefetch(boolean)
public java.lang.String getDatabaseProductVersion()
throws java.sql.SQLException
public boolean getReportRemarks()
public short getVersionNumber()
throws java.sql.SQLException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||