org.springframework.jdbc.support.nativejdbc
Class WebSphereNativeJdbcExtractor

java.lang.Object
  extended by org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractorAdapter
      extended by org.springframework.jdbc.support.nativejdbc.WebSphereNativeJdbcExtractor
All Implemented Interfaces:
NativeJdbcExtractor

public class WebSphereNativeJdbcExtractor
extends NativeJdbcExtractorAdapter

Implementation of the NativeJdbcExtractor interface for WebSphere, supporting WebSphere Application Server 5.1 and higher.

Returns the underlying native Connection to application code instead of WebSphere's wrapper implementation; unwraps the Connection for native statements. The returned JDBC classes can then safely be cast, e.g. to oracle.jdbc.OracleConnection.

This NativeJdbcExtractor can be set just to allow working with a WebSphere DataSource: If a given object is not a WebSphere Connection wrapper, it will be returned as-is.

Since:
1.1
Author:
Juergen Hoeller
See Also:
com.ibm.ws.rsadapter.jdbc.WSJdbcConnection, com.ibm.ws.rsadapter.jdbc.WSJdbcUtil#getNativeConnection

Constructor Summary
WebSphereNativeJdbcExtractor()
          This constructor retrieves WebSphere JDBC adapter classes, so we can get the underlying vendor connection using reflection.
 
Method Summary
protected  Connection doGetNativeConnection(Connection con)
          Retrieve the Connection via WebSphere's getNativeConnection method.
 boolean isNativeConnectionNecessaryForNativeCallableStatements()
          Return true, as WebSphere returns wrapped CallableStatements.
 boolean isNativeConnectionNecessaryForNativePreparedStatements()
          Return true, as WebSphere returns wrapped PreparedStatements.
 boolean isNativeConnectionNecessaryForNativeStatements()
          Return true, as WebSphere returns wrapped Statements.
 
Methods inherited from class org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractorAdapter
getNativeCallableStatement, getNativeConnection, getNativeConnectionFromStatement, getNativePreparedStatement, getNativeResultSet, getNativeStatement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebSphereNativeJdbcExtractor

public WebSphereNativeJdbcExtractor()
This constructor retrieves WebSphere JDBC adapter classes, so we can get the underlying vendor connection using reflection.

Method Detail

isNativeConnectionNecessaryForNativeStatements

public boolean isNativeConnectionNecessaryForNativeStatements()
Return true, as WebSphere returns wrapped Statements.

Specified by:
isNativeConnectionNecessaryForNativeStatements in interface NativeJdbcExtractor
Overrides:
isNativeConnectionNecessaryForNativeStatements in class NativeJdbcExtractorAdapter

isNativeConnectionNecessaryForNativePreparedStatements

public boolean isNativeConnectionNecessaryForNativePreparedStatements()
Return true, as WebSphere returns wrapped PreparedStatements.

Specified by:
isNativeConnectionNecessaryForNativePreparedStatements in interface NativeJdbcExtractor
Overrides:
isNativeConnectionNecessaryForNativePreparedStatements in class NativeJdbcExtractorAdapter

isNativeConnectionNecessaryForNativeCallableStatements

public boolean isNativeConnectionNecessaryForNativeCallableStatements()
Return true, as WebSphere returns wrapped CallableStatements.

Specified by:
isNativeConnectionNecessaryForNativeCallableStatements in interface NativeJdbcExtractor
Overrides:
isNativeConnectionNecessaryForNativeCallableStatements in class NativeJdbcExtractorAdapter

doGetNativeConnection

protected Connection doGetNativeConnection(Connection con)
                                    throws SQLException
Retrieve the Connection via WebSphere's getNativeConnection method.

Overrides:
doGetNativeConnection in class NativeJdbcExtractorAdapter
Throws:
SQLException