| java.lang.Object org.springframework.jdbc.support.lob.AbstractLobHandler org.springframework.jdbc.support.lob.OracleLobHandler
OracleLobHandler | public class OracleLobHandler extends AbstractLobHandler (Code) | | LobHandler implementation for Oracle databases. Uses proprietary API to
create oracle.sql.BLOB and oracle.sql.CLOB
instances, as necessary when working with Oracle's JDBC driver.
Note that this LobHandler requires Oracle JDBC driver 9i or higher!
While most databases are able to work with DefaultLobHandler, Oracle just
accepts Blob/Clob instances created via its own proprietary BLOB/CLOB API,
and additionally doesn't accept large streams for PreparedStatement's
corresponding setter methods. Therefore, you need to use a strategy like
this LobHandler implementation.
Needs to work on a native JDBC Connection, to be able to cast it to
oracle.jdbc.OracleConnection . If you pass in Connections from
a connection pool (the usual case in a J2EE environment), you need to set
an appropriate NativeJdbcExtractor to allow for automatical retrieval of
the underlying native JDBC Connection. LobHandler and NativeJdbcExtractor
are separate concerns, therefore they are represented by separate strategy
interfaces.
Coded via reflection to avoid dependencies on Oracle classes.
Even reads in Oracle constants via reflection because of different Oracle
drivers (classes12, ojdbc14) having different constant values! As this
LobHandler initializes Oracle classes on instantiation, do not define this
as eager-initializing singleton if you do not want to depend on the Oracle
JAR being in the class path: use "lazy-init=true" to avoid this issue.
author: Juergen Hoeller since: 04.12.2003 See Also: OracleLobHandler.setNativeJdbcExtractor See Also: oracle.sql.BLOB See Also: oracle.sql.CLOB |
Inner Class :protected class OracleLobCreator implements LobCreator | |
Inner Class :protected static interface LobCallback | |
Field Summary | |
final protected Log | logger |
logger | final protected Log logger(Code) | | |
initOracleDriverClasses | protected synchronized void initOracleDriverClasses(Connection con)(Code) | | Retrieve the oracle.sql.BLOB and oracle.sql.CLOB
classes via reflection, and initialize the values for the
DURATION_SESSION and MODE_READWRITE constants defined there.
Parameters: con - the Oracle Connection, for using the exact same class loaderthat the Oracle driver was loaded with See Also: oracle.sql.BLOB.DURATION_SESSION See Also: oracle.sql.BLOB.MODE_READWRITE See Also: oracle.sql.CLOB.DURATION_SESSION See Also: oracle.sql.CLOB.MODE_READWRITE |
setCache | public void setCache(boolean cache)(Code) | | Set whether to cache the temporary LOB in the buffer cache.
This value will be passed into BLOB/CLOB.createTemporary. Default is "true".
See Also: oracle.sql.BLOB.createTemporary See Also: oracle.sql.CLOB.createTemporary |
setNativeJdbcExtractor | public void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor)(Code) | | Set an appropriate NativeJdbcExtractor to be able to retrieve the underlying
native oracle.jdbc.OracleConnection . This is necessary for
DataSource-based connection pools, as those need to return wrapped JDBC
Connection handles that cannot be cast to a native Connection implementation.
Effectively, this LobHandler just invokes a single NativeJdbcExtractor
method, namely getNativeConnectionFromStatement with a
PreparedStatement argument (falling back to a
PreparedStatement.getConnection() call if no extractor is set).
A common choice is SimpleNativeJdbcExtractor, whose Connection unwrapping
(which is what OracleLobHandler needs) will work with many connection pools.
See SimpleNativeJdbcExtractor's javadoc for details.
See Also: org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor.getNativeConnectionFromStatement See Also: org.springframework.jdbc.support.nativejdbc.SimpleNativeJdbcExtractor See Also: oracle.jdbc.OracleConnection |
|
|