Class Jdbc41Bridge
- java.lang.Object
- 
- org.apache.tomcat.dbcp.dbcp2.Jdbc41Bridge
 
- 
 public class Jdbc41Bridge extends java.lang.ObjectDefines bridge methods to JDBC 4.1 (Java 7) methods to allow call sites to operate safely (withoutAbstractMethodError) when using a JDBC driver written for JDBC 4.0 (Java 6).There should be no need to this kind of code for JDBC 4.2 in Java 8 due to JDBC's use of default methods. This should probably be moved or at least copied in some form to Apache Commons DbUtils. - Since:
- 2.6.0
 
- 
- 
Constructor SummaryConstructors Constructor Description Jdbc41Bridge()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static voidabort(java.sql.Connection connection, java.util.concurrent.Executor executor)Delegates toConnection.abort(Executor)without throwing anAbstractMethodError.static voidcloseOnCompletion(java.sql.Statement statement)Delegates toStatement.closeOnCompletion()without throwing anAbstractMethodError.static booleangeneratedKeyAlwaysReturned(java.sql.DatabaseMetaData databaseMetaData)Delegates toDatabaseMetaData.generatedKeyAlwaysReturned()without throwing aAbstractMethodError.static intgetNetworkTimeout(java.sql.Connection connection)Delegates toConnection.getNetworkTimeout()without throwing anAbstractMethodError.static <T> TgetObject(java.sql.ResultSet resultSet, int columnIndex, java.lang.Class<T> type)Delegates toResultSet.getObject(int, Class)without throwing anAbstractMethodError.static <T> TgetObject(java.sql.ResultSet resultSet, java.lang.String columnLabel, java.lang.Class<T> type)Delegates toResultSet.getObject(String, Class)without throwing anAbstractMethodError.static java.util.logging.LoggergetParentLogger(javax.sql.CommonDataSource commonDataSource)Delegates toCommonDataSource.getParentLogger()without throwing anAbstractMethodError.static java.sql.ResultSetgetPseudoColumns(java.sql.DatabaseMetaData databaseMetaData, java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern, java.lang.String columnNamePattern)Delegates toDatabaseMetaData.getPseudoColumns(String, String, String, String)without throwing aAbstractMethodError.static java.lang.StringgetSchema(java.sql.Connection connection)Delegates toConnection.getSchema()without throwing anAbstractMethodError.static booleanisCloseOnCompletion(java.sql.Statement statement)Delegates toStatement.isCloseOnCompletion()without throwing anAbstractMethodError.static voidsetNetworkTimeout(java.sql.Connection connection, java.util.concurrent.Executor executor, int milliseconds)Delegates toConnection.setNetworkTimeout(Executor, int)without throwing anAbstractMethodError.static voidsetSchema(java.sql.Connection connection, java.lang.String schema)Delegates toConnection.setSchema(String)without throwing anAbstractMethodError.
 
- 
- 
- 
Method Detail- 
abortpublic static void abort(java.sql.Connection connection, java.util.concurrent.Executor executor) throws java.sql.SQLExceptionDelegates toConnection.abort(Executor)without throwing anAbstractMethodError.If the JDBC driver does not implement Connection.abort(Executor), then callConnection.close().- Parameters:
- connection- the receiver
- executor- See- Connection.abort(Executor).
- Throws:
- java.sql.SQLException- See- Connection.abort(Executor).
- See Also:
- Connection.abort(Executor)
 
 - 
closeOnCompletionpublic static void closeOnCompletion(java.sql.Statement statement) throws java.sql.SQLExceptionDelegates toStatement.closeOnCompletion()without throwing anAbstractMethodError.If the JDBC driver does not implement Statement.closeOnCompletion(), then just check that the connection is closed to then throw an SQLException.- Parameters:
- statement- See- Statement.closeOnCompletion()
- Throws:
- java.sql.SQLException- See- Statement.closeOnCompletion()
- See Also:
- Statement.closeOnCompletion()
 
 - 
generatedKeyAlwaysReturnedpublic static boolean generatedKeyAlwaysReturned(java.sql.DatabaseMetaData databaseMetaData) throws java.sql.SQLExceptionDelegates toDatabaseMetaData.generatedKeyAlwaysReturned()without throwing aAbstractMethodError.If the JDBC driver does not implement DatabaseMetaData.generatedKeyAlwaysReturned(), then return false.- Parameters:
- databaseMetaData- See- DatabaseMetaData.generatedKeyAlwaysReturned()
- Returns:
- See DatabaseMetaData.generatedKeyAlwaysReturned()
- Throws:
- java.sql.SQLException- See- DatabaseMetaData.generatedKeyAlwaysReturned()
- See Also:
- DatabaseMetaData.generatedKeyAlwaysReturned()
 
 - 
getNetworkTimeoutpublic static int getNetworkTimeout(java.sql.Connection connection) throws java.sql.SQLExceptionDelegates toConnection.getNetworkTimeout()without throwing anAbstractMethodError.If the JDBC driver does not implement Connection.getNetworkTimeout(), then return 0.- Parameters:
- connection- the receiver
- Returns:
- See Connection.getNetworkTimeout()
- Throws:
- java.sql.SQLException- See- Connection.getNetworkTimeout()
- See Also:
- Connection.getNetworkTimeout()
 
 - 
getObjectpublic static <T> T getObject(java.sql.ResultSet resultSet, int columnIndex, java.lang.Class<T> type) throws java.sql.SQLExceptionDelegates toResultSet.getObject(int, Class)without throwing anAbstractMethodError.If the JDBC driver does not implement ResultSet.getObject(int, Class), then return 0.- Type Parameters:
- T- See- ResultSet.getObject(int, Class)
- Parameters:
- resultSet- See- ResultSet.getObject(int, Class)
- columnIndex- See- ResultSet.getObject(int, Class)
- type- See- ResultSet.getObject(int, Class)
- Returns:
- See ResultSet.getObject(int, Class)
- Throws:
- java.sql.SQLException- See- ResultSet.getObject(int, Class)
- See Also:
- ResultSet.getObject(int, Class)
 
 - 
getObjectpublic static <T> T getObject(java.sql.ResultSet resultSet, java.lang.String columnLabel, java.lang.Class<T> type) throws java.sql.SQLExceptionDelegates toResultSet.getObject(String, Class)without throwing anAbstractMethodError.- Type Parameters:
- T- See- ResultSet.getObject(String, Class)
- Parameters:
- resultSet- See- ResultSet.getObject(String, Class)
- columnLabel- See- ResultSet.getObject(String, Class)
- type- See- ResultSet.getObject(String, Class)
- Returns:
- See ResultSet.getObject(String, Class)
- Throws:
- java.sql.SQLException- See- ResultSet.getObject(String, Class)
- See Also:
- ResultSet.getObject(int, Class)
 
 - 
getParentLoggerpublic static java.util.logging.Logger getParentLogger(javax.sql.CommonDataSource commonDataSource) throws java.sql.SQLFeatureNotSupportedExceptionDelegates toCommonDataSource.getParentLogger()without throwing anAbstractMethodError.If the JDBC driver does not implement CommonDataSource.getParentLogger(), then return null.- Parameters:
- commonDataSource- See- CommonDataSource.getParentLogger()
- Returns:
- See CommonDataSource.getParentLogger()
- Throws:
- java.sql.SQLFeatureNotSupportedException- See- CommonDataSource.getParentLogger()
 
 - 
getPseudoColumnspublic static java.sql.ResultSet getPseudoColumns(java.sql.DatabaseMetaData databaseMetaData, java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern, java.lang.String columnNamePattern) throws java.sql.SQLExceptionDelegates toDatabaseMetaData.getPseudoColumns(String, String, String, String)without throwing aAbstractMethodError.If the JDBC driver does not implement DatabaseMetaData.getPseudoColumns(String, String, String, String), then return null.- Parameters:
- databaseMetaData- the receiver
- catalog- See- DatabaseMetaData.getPseudoColumns(String, String, String, String)
- schemaPattern- See- DatabaseMetaData.getPseudoColumns(String, String, String, String)
- tableNamePattern- See- DatabaseMetaData.getPseudoColumns(String, String, String, String)
- columnNamePattern- See- DatabaseMetaData.getPseudoColumns(String, String, String, String)
- Returns:
- See DatabaseMetaData.getPseudoColumns(String, String, String, String)
- Throws:
- java.sql.SQLException- See- DatabaseMetaData.getPseudoColumns(String, String, String, String)
- See Also:
- DatabaseMetaData.getPseudoColumns(String, String, String, String)
 
 - 
getSchemapublic static java.lang.String getSchema(java.sql.Connection connection) throws java.sql.SQLExceptionDelegates toConnection.getSchema()without throwing anAbstractMethodError.If the JDBC driver does not implement Connection.getSchema(), then return null.- Parameters:
- connection- the receiver
- Returns:
- null for a JDBC 4 driver or a value per Connection.getSchema().
- Throws:
- java.sql.SQLException- See- Connection.getSchema().
- See Also:
- Connection.getSchema()
 
 - 
isCloseOnCompletionpublic static boolean isCloseOnCompletion(java.sql.Statement statement) throws java.sql.SQLExceptionDelegates toStatement.isCloseOnCompletion()without throwing anAbstractMethodError.If the JDBC driver does not implement Statement.isCloseOnCompletion(), then just check that the connection is closed to then throw an SQLException.- Parameters:
- statement- See- Statement.isCloseOnCompletion()
- Returns:
- See Statement.isCloseOnCompletion()
- Throws:
- java.sql.SQLException- See- Statement.isCloseOnCompletion()
- See Also:
- Statement.closeOnCompletion()
 
 - 
setNetworkTimeoutpublic static void setNetworkTimeout(java.sql.Connection connection, java.util.concurrent.Executor executor, int milliseconds) throws java.sql.SQLExceptionDelegates toConnection.setNetworkTimeout(Executor, int)without throwing anAbstractMethodError.If the JDBC driver does not implement Connection.setNetworkTimeout(Executor, int), then do nothing.- Parameters:
- connection- the receiver
- executor- See- Connection.setNetworkTimeout(Executor, int)
- milliseconds-- Connection.setNetworkTimeout(Executor, int)
- Throws:
- java.sql.SQLException-- Connection.setNetworkTimeout(Executor, int)
- See Also:
- Connection.setNetworkTimeout(Executor, int)
 
 - 
setSchemapublic static void setSchema(java.sql.Connection connection, java.lang.String schema) throws java.sql.SQLExceptionDelegates toConnection.setSchema(String)without throwing anAbstractMethodError.If the JDBC driver does not implement Connection.setSchema(String), then do nothing.- Parameters:
- connection- the receiver
- schema- See- Connection.setSchema(String).
- Throws:
- java.sql.SQLException- See- Connection.setSchema(String).
- See Also:
- Connection.setSchema(String)
 
 
- 
 
-