public class WebLogicNativeJdbcExtractor extends NativeJdbcExtractorAdapter
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.
NativeJdbcExtractorAdapter.getNativeConnection(java.sql.Connection)
,
weblogic.jdbc.extensions.WLConnection#getVendorConnection
Modifier and Type | Field and Description |
---|---|
private java.lang.reflect.Method |
getVendorConnectionMethod |
private static java.lang.String |
JDBC_EXTENSION_NAME |
private java.lang.Class |
jdbcExtensionClass |
Constructor and Description |
---|
WebLogicNativeJdbcExtractor()
This constructor retrieves the WebLogic JDBC extension interface,
so we can get the underlying vendor connection using reflection.
|
Modifier and Type | Method and Description |
---|---|
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. |
getNativeCallableStatement, getNativeConnection, getNativeConnectionFromStatement, getNativePreparedStatement, getNativeResultSet, getNativeStatement
private static final java.lang.String JDBC_EXTENSION_NAME
private final java.lang.Class jdbcExtensionClass
private final java.lang.reflect.Method getVendorConnectionMethod
public WebLogicNativeJdbcExtractor()
public boolean isNativeConnectionNecessaryForNativeStatements()
true
, as WebLogic returns wrapped Statements.isNativeConnectionNecessaryForNativeStatements
in interface NativeJdbcExtractor
isNativeConnectionNecessaryForNativeStatements
in class NativeJdbcExtractorAdapter
public boolean isNativeConnectionNecessaryForNativePreparedStatements()
true
, as WebLogic returns wrapped PreparedStatements.isNativeConnectionNecessaryForNativePreparedStatements
in interface NativeJdbcExtractor
isNativeConnectionNecessaryForNativePreparedStatements
in class NativeJdbcExtractorAdapter
public boolean isNativeConnectionNecessaryForNativeCallableStatements()
true
, as WebLogic returns wrapped CallableStatements.isNativeConnectionNecessaryForNativeCallableStatements
in interface NativeJdbcExtractor
isNativeConnectionNecessaryForNativeCallableStatements
in class NativeJdbcExtractorAdapter
protected java.sql.Connection doGetNativeConnection(java.sql.Connection con) throws java.sql.SQLException
getVendorConnection
method.doGetNativeConnection
in class NativeJdbcExtractorAdapter
java.sql.SQLException