org.springframework.jdbc.support.nativejdbc
Class CommonsDbcpNativeJdbcExtractor


public class CommonsDbcpNativeJdbcExtractor
implements NativeJdbcExtractor

Implementation of the NativeJdbcExtractor interface for the Jakarta Commons DBCP connection pool. Returns the underlying native Connection, Statement, ResultSet etc to application code instead of DBCP's wrapper implementations. The returned JDBC classes can then safely be cast, e.g. to OracleResultSet.

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

Note: Before Commons DBCP 1.1, DelegatingCallableStatement and DelegatingResultSet have not offered any means to access underlying delegates. Therefore, getNativeCallableStatement and getNativeResultSet will just work with DBCP 1.1. But getNativeResultSet will not be invoked by JdbcTemplate for a wrapped ResultSet anyway, because getNativeStatement/getNativePreparedStatement will already have returned the underlying delegate before.

Author:
Juergen Hoeller
Since: 25.08.2003
See Also: org.springframework.jdbc.core.JdbcTemplate.setNativeJdbcExtractor(org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor)

Method Summary
 CallableStatementgetNativeCallableStatement(CallableStatement cs)
           
 ConnectiongetNativeConnection(Connection con)
           
 ConnectiongetNativeConnectionFromStatement(Statement stmt)
           
 PreparedStatementgetNativePreparedStatement(PreparedStatement ps)
           
 ResultSetgetNativeResultSet(ResultSet rs)
           
 StatementgetNativeStatement(Statement stmt)
           
 booleanisNativeConnectionNecessaryForNativeCallableStatements()
           
 booleanisNativeConnectionNecessaryForNativePreparedStatements()
           
 booleanisNativeConnectionNecessaryForNativeStatements()
           

Method Detail

getNativeCallableStatement

public CallableStatement getNativeCallableStatement(CallableStatement cs)

getNativeConnection

public Connection getNativeConnection(Connection con)

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()