Skip to content

OracleLobHandler + WebSphereNativeJdbcExtractor doesn't work on Websphere 6 [SPR-1317] #6017

@spring-projects-issues

Description

@spring-projects-issues

Davor Cengija opened SPR-1317 and commented

Hi,

we are developing application on Websphere 6 with Oracle 9i database. Some LOBs are saved to database using Hibernate 3. We are using Websphere datasource so we need to use WebSphereNativeJdbcExtractor which causes us problems.

Our configuration:

<!-- Lob handler for Oracle 9i and IBM Websphere data source -->
<bean id="lobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler">
<property name="nativeJdbcExtractor">
<bean class="org.springframework.jdbc.support.nativejdbc.WebSphereNativeJdbcExtractor"/>
</property>
</bean>
<!---- Hibernate session factory definition -->
<bean id="auditSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="lobHandler" ref="lobHandler"/>
...

When LOB object is about to be saved exception is thrown:

org.springframework.dao.DataAccessResourceFailureException: Could not create Oracle LOB; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: OracleLobCreator needs to work on [oracle.jdbc.OracleConnection], not on [class oracle.jdbc.driver.OracleConnection] - specify a corresponding NativeJdbcExtractor
org.springframework.dao.InvalidDataAccessApiUsageException: OracleLobCreator needs to work on [oracle.jdbc.OracleConnection], not on [class oracle.jdbc.driver.OracleConnection] - specify a corresponding NativeJdbcExtractor
at org.springframework.jdbc.support.lob.OracleLobHandler$OracleLobCreator.getOracleConnection(OracleLobHandler.java:360)
at org.springframework.jdbc.support.lob.OracleLobHandler$OracleLobCreator.createLob(OracleLobHandler.java:328)

return in code below from WebSphereNativeJdbcExtractor returned connection is type of oracle.jdbc.driver.OracleConnection instead of oracle.jdbc.OracleConnection
/**

  • Retrieve the Connection via WebSphere's <code>getNativeConnection</code> method.
    */
    protected Connection doGetNativeConnection(Connection con) throws SQLException {
    // WebSphere 5 connection?
    if (this.webSphere5ConnectionClass != null &&
    this.webSphere5ConnectionClass.isAssignableFrom(con.getClass())) {
    try {
    // WebSphere 5's WSJdbcUtil.getNativeConnection(wsJdbcConnection)
    return (Connection) this.webSphere5NativeConnectionMethod.invoke(null, new Object[] {con});
    }

So in org.springframework.jdbc.support.lob.OracleLobHandler in getOracleConnection() conToUse is type of oracle.jdbc.driver.OracleConnection (implements java.sql.Connection) and
connectionClass is oracle.jdbc.OracleConnection type. Because of that, exception is throwned (as specified in getOracleConnection()). We are using ojdbc14.jar for database connection.

We hope that you will do some testing on Websphere 6 to resolve this problem.


Affects: 1.2.4

Metadata

Metadata

Assignees

Labels

in: dataIssues in data modules (jdbc, orm, oxm, tx)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions