org.springframework.jdbc.support.nativejdbc
Class WebLogicNativeJdbcExtractor

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

public class WebLogicNativeJdbcExtractor
extends NativeJdbcExtractorAdapter

Implementation of the NativeJdbcExtractor interface for WebLogic, supporting WebLogic Server 8.1 and higher.

Returns the underlying native Connection to application code instead of WebLogic'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 WebLogic DataSource: If a given object is not a WebLogic Connection wrapper, it will be returned as-is.

Since:
1.0.2
Author:
Thomas Risberg, Juergen Hoeller
See Also:
NativeJdbcExtractorAdapter.getNativeConnection(java.sql.Connection), weblogic.jdbc.extensions.WLConnection#getVendorConnection

Field Summary
private  java.lang.reflect.Method getVendorConnectionMethod
           
private static java.lang.String JDBC_EXTENSION_NAME
           
private  java.lang.Class jdbcExtensionClass
           
 
Constructor Summary
WebLogicNativeJdbcExtractor()
          This constructor retrieves the WebLogic JDBC extension interface, so we can get the underlying vendor connection using reflection.
 
Method Summary
protected  java.sql.Connection doGetNativeConnection(java.sql.Connection con)
          Retrieve the Connection via WebLogic's getVendorConnection method.
 boolean isNativeConnectionNecessaryForNativeCallableStatements()
          Return true, as WebLogic returns wrapped CallableStatements.
 boolean isNativeConnectionNecessaryForNativePreparedStatements()
          Return true, as WebLogic returns wrapped PreparedStatements.
 boolean isNativeConnectionNecessaryForNativeStatements()
          Return true, as WebLogic 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
 

Field Detail

JDBC_EXTENSION_NAME

private static final java.lang.String JDBC_EXTENSION_NAME
See Also:
Constant Field Values

jdbcExtensionClass

private final java.lang.Class jdbcExtensionClass

getVendorConnectionMethod

private final java.lang.reflect.Method getVendorConnectionMethod
Constructor Detail

WebLogicNativeJdbcExtractor

public WebLogicNativeJdbcExtractor()
This constructor retrieves the WebLogic JDBC extension interface, so we can get the underlying vendor connection using reflection.

Method Detail

isNativeConnectionNecessaryForNativeStatements

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

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

isNativeConnectionNecessaryForNativePreparedStatements

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

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

isNativeConnectionNecessaryForNativeCallableStatements

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

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

doGetNativeConnection

protected java.sql.Connection doGetNativeConnection(java.sql.Connection con)
                                             throws java.sql.SQLException
Retrieve the Connection via WebLogic's getVendorConnection method.

Overrides:
doGetNativeConnection in class NativeJdbcExtractorAdapter
Throws:
java.sql.SQLException