org.apache.ojb.broker.platforms
Class PlatformOracle9iImpl
java.lang.Object
org.apache.ojb.broker.platforms.PlatformDefaultImpl
org.apache.ojb.broker.platforms.PlatformOracleImpl
org.apache.ojb.broker.platforms.PlatformOracle9iImpl
- All Implemented Interfaces:
- JoinSyntaxTypes, Platform
- public class PlatformOracle9iImpl
- extends PlatformOracleImpl
This class is a concrete implementation of Platform
. Provides
an implementation that works around some issues with Oracle in general and
Oracle 9i's Thin driver in particular.
Optimization: Oracle Batching (not standard JDBC batching)
see http://technet.oracle.com/products/oracle9i/daily/jun07.html
Optimization: Oracle Prefetching
see http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/advanced/RowPrefetchSample/Readme.html
Optimization: Oracle Statement Caching
see http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/jdbc30/StmtCacheSample/Readme.html
TODO: Optimization: use ROWNUM to minimize the effects of not having server side cursors
see http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:127412348064
- Version:
- CVS $Id$
- Author:
- Matthew Baird, Erik Forkalsrud, Martin Kalén
- See Also:
Platform
,
PlatformDefaultImpl
,
PlatformOracleImpl
Method Summary |
void |
addBatch(java.sql.PreparedStatement stmt)
Try Oracle update batching and call executeUpdate or revert to
JDBC update batching. |
void |
afterStatementCreate(java.sql.Statement stmt)
Enables Oracle row prefetching if supported. |
void |
beforeBatch(java.sql.PreparedStatement stmt)
Try Oracle update batching and call setExecuteBatch or revert to
JDBC update batching. |
int[] |
executeBatch(java.sql.PreparedStatement stmt)
Try Oracle update batching and call sendBatch or revert to
JDBC update batching. |
void |
initializeJdbcConnection(JdbcConnectionDescriptor jcd,
java.sql.Connection conn)
Enables Oracle statement caching if supported by the JDBC-driver. |
void |
setObjectForStatement(java.sql.PreparedStatement ps,
int index,
java.lang.Object value,
int sqlType)
For objects beyond 4k, weird things happen in Oracle if you try to use "setBytes", so for
all cases it's better to use setBinaryStream. |
Methods inherited from class org.apache.ojb.broker.platforms.PlatformDefaultImpl |
addPagingSql, afterStatementClose, beforeStatementClose, bindPagingParameters, bindPagingParametersFirst, changeAutoCommitState, checkForBatchSupport, concatenate, getConcatenationCharacter, getEscapeClause, getLastInsertIdentityQuery, prepareNextValProcedureStatement, setNullForStatement, supportsBatchOperations, supportsPaging, useCountForResultsetSize |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
STATEMENT_CACHE_SIZE
protected static final int STATEMENT_CACHE_SIZE
- See Also:
- Constant Field Values
ROW_PREFETCH_SIZE
protected static final int ROW_PREFETCH_SIZE
- See Also:
- Constant Field Values
STATEMENTS_PER_BATCH
protected static final int STATEMENTS_PER_BATCH
- See Also:
- Constant Field Values
m_batchStatementsInProgress
protected static java.util.Map m_batchStatementsInProgress
PARAM_TYPE_INTEGER
protected static final java.lang.Class[] PARAM_TYPE_INTEGER
PARAM_TYPE_BOOLEAN
protected static final java.lang.Class[] PARAM_TYPE_BOOLEAN
PARAM_TYPE_STRING
protected static final java.lang.Class[] PARAM_TYPE_STRING
PARAM_STATEMENT_CACHE_SIZE
protected static final java.lang.Object[] PARAM_STATEMENT_CACHE_SIZE
PARAM_ROW_PREFETCH_SIZE
protected static final java.lang.Object[] PARAM_ROW_PREFETCH_SIZE
PARAM_STATEMENT_BATCH_SIZE
protected static final java.lang.Object[] PARAM_STATEMENT_BATCH_SIZE
PARAM_BOOLEAN_TRUE
protected static final java.lang.Object[] PARAM_BOOLEAN_TRUE
BASE_CLOB
protected static final JdbcType BASE_CLOB
BASE_BLOB
protected static final JdbcType BASE_BLOB
PlatformOracle9iImpl
public PlatformOracle9iImpl()
initializeJdbcConnection
public void initializeJdbcConnection(JdbcConnectionDescriptor jcd,
java.sql.Connection conn)
throws PlatformException
- Enables Oracle statement caching if supported by the JDBC-driver.
See
"http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/jdbc30/StmtCacheSample/Readme.html"
- Specified by:
initializeJdbcConnection
in interface Platform
- Overrides:
initializeJdbcConnection
in class PlatformDefaultImpl
- Parameters:
jcd
- the OJB JdbcConnectionDescriptor
(metadata) for the connection to be initializedconn
- the Connection
-object (physical) to be initialized
- Throws:
PlatformException
- See Also:
PlatformDefaultImpl.initializeJdbcConnection(org.apache.ojb.broker.metadata.JdbcConnectionDescriptor, java.sql.Connection)
afterStatementCreate
public void afterStatementCreate(java.sql.Statement stmt)
throws PlatformException
- Enables Oracle row prefetching if supported.
See http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/advanced/RowPrefetchSample/Readme.html.
This is RDBMS server-to-client prefetching and thus one layer below
the OJB-internal prefetching-to-cache introduced in version 1.0rc5.
- Specified by:
afterStatementCreate
in interface Platform
- Overrides:
afterStatementCreate
in class PlatformOracleImpl
- Parameters:
stmt
- the statement just created
- Throws:
PlatformException
- upon JDBC failure
beforeBatch
public void beforeBatch(java.sql.PreparedStatement stmt)
throws PlatformException
- Try Oracle update batching and call setExecuteBatch or revert to
JDBC update batching. See 12-2 Update Batching in the Oracle9i
JDBC Developer's Guide and Reference.
- Specified by:
beforeBatch
in interface Platform
- Overrides:
beforeBatch
in class PlatformDefaultImpl
- Parameters:
stmt
- the prepared statement to be used for batching
- Throws:
PlatformException
- upon JDBC failure
addBatch
public void addBatch(java.sql.PreparedStatement stmt)
throws PlatformException
- Try Oracle update batching and call executeUpdate or revert to
JDBC update batching.
- Specified by:
addBatch
in interface Platform
- Overrides:
addBatch
in class PlatformDefaultImpl
- Parameters:
stmt
- the statement beeing added to the batch
- Throws:
PlatformException
- upon JDBC failure
executeBatch
public int[] executeBatch(java.sql.PreparedStatement stmt)
throws PlatformException
- Try Oracle update batching and call sendBatch or revert to
JDBC update batching.
- Specified by:
executeBatch
in interface Platform
- Overrides:
executeBatch
in class PlatformDefaultImpl
- Parameters:
stmt
- the batched prepared statement about to be executed
- Returns:
- always
null
if Oracle update batching is used,
since it is impossible to dissolve total row count into distinct
statement counts. If JDBC update batching is used, an int array is
returned containing number of updated rows for each batched statement.
- Throws:
PlatformException
- upon JDBC failure
setObjectForStatement
public void setObjectForStatement(java.sql.PreparedStatement ps,
int index,
java.lang.Object value,
int sqlType)
throws java.sql.SQLException
- Description copied from class:
PlatformOracleImpl
- For objects beyond 4k, weird things happen in Oracle if you try to use "setBytes", so for
all cases it's better to use setBinaryStream. Oracle also requires a change in the resultset
type of the prepared statement. MBAIRD NOTE: BLOBS may not work with Oracle database/thin
driver versions prior to 8.1.6.
- Specified by:
setObjectForStatement
in interface Platform
- Overrides:
setObjectForStatement
in class PlatformOracleImpl
- Throws:
java.sql.SQLException
- See Also:
Platform.setObjectForStatement(java.sql.PreparedStatement, int, java.lang.Object, int)
Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14