org.springframework.jdbc.support.nativejdbc
Class SimpleNativeJdbcExtractor


public class SimpleNativeJdbcExtractor
implements NativeJdbcExtractor

Simple implementation of the NativeJdbcExtractor interface. Assumes a pool that just wraps Connections but not Statements/ResultSets: In this case, the underlying native Connection can be retrieved by simply opening a Statement and invoking Statement.getConnection(). All other JDBC objects will be returned as passed in.

Known to work with Resin 2.1 and C3P0, but should work with any pool that does not wrap Statements and ResultSets, or at least returns the native Connection on Statement.getConnection.

Author:
Juergen Hoeller
Since: 05.12.2003

Method Summary
 CallableStatementgetNativeCallableStatement(CallableStatement cs)
           
 ConnectiongetNativeConnection(Connection con)
           
 ConnectiongetNativeConnectionFromStatement(Statement stmt)
           
 PreparedStatementgetNativePreparedStatement(PreparedStatement ps)
           
 ResultSetgetNativeResultSet(ResultSet rs)
           
 StatementgetNativeStatement(Statement stmt)
           
 booleanisNativeConnectionNecessaryForNativeCallableStatements()
           
 booleanisNativeConnectionNecessaryForNativePreparedStatements()
           
 booleanisNativeConnectionNecessaryForNativeStatements()
           
 voidsetNativeConnectionNecessaryForNativeCallableStatements(boolean nativeConnectionNecessary)
          Set whether it is necessary to work on the native Connection to receive native CallableStatements.
 voidsetNativeConnectionNecessaryForNativePreparedStatements(boolean nativeConnectionNecessary)
          Set whether it is necessary to work on the native Connection to receive native PreparedStatements.
 voidsetNativeConnectionNecessaryForNativeStatements(boolean nativeConnectionNecessary)
          Set whether it is necessary to work on the native Connection to receive native Statements.

Method Detail

getNativeCallableStatement

public CallableStatement getNativeCallableStatement(CallableStatement cs)

getNativeConnection

public Connection getNativeConnection(Connection con)
throws java.sql.SQLException

getNativeConnectionFromStatement

public Connection getNativeConnectionFromStatement(Statement stmt)
throws java.sql.SQLException

getNativePreparedStatement

public PreparedStatement getNativePreparedStatement(PreparedStatement ps)

getNativeResultSet

public ResultSet getNativeResultSet(ResultSet rs)
throws java.sql.SQLException

getNativeStatement

public Statement getNativeStatement(Statement stmt)

isNativeConnectionNecessaryForNativeCallableStatements

public boolean isNativeConnectionNecessaryForNativeCallableStatements()

isNativeConnectionNecessaryForNativePreparedStatements

public boolean isNativeConnectionNecessaryForNativePreparedStatements()

isNativeConnectionNecessaryForNativeStatements

public boolean isNativeConnectionNecessaryForNativeStatements()

setNativeConnectionNecessaryForNativeCallableStatements

public void setNativeConnectionNecessaryForNativeCallableStatements(boolean nativeConnectionNecessary)
Set whether it is necessary to work on the native Connection to receive native CallableStatements. Default is false.

This makes sense if you need to work with native Statements/ResultSets from a pool that does not allow to extract the native JDBC objects from its wrappers but returns the native Connection on Statement.getConnection, like C3P0.


setNativeConnectionNecessaryForNativePreparedStatements

public void setNativeConnectionNecessaryForNativePreparedStatements(boolean nativeConnectionNecessary)
Set whether it is necessary to work on the native Connection to receive native PreparedStatements. Default is false.

This makes sense if you need to work with native Statements/ResultSets from a pool that does not allow to extract the native JDBC objects from its wrappers but returns the native Connection on Statement.getConnection, like C3P0.


setNativeConnectionNecessaryForNativeStatements

public void setNativeConnectionNecessaryForNativeStatements(boolean nativeConnectionNecessary)
Set whether it is necessary to work on the native Connection to receive native Statements. Default is false.

This makes sense if you need to work with native Statements/ResultSets from a pool that does not allow to extract the native JDBC objects from its wrappers but returns the native Connection on Statement.getConnection, like C3P0.