コード例 #1
0
 /**
  * This implementation delegates to the underlying DataSource.
  *
  * @see javax.sql.DataSource#getConnection()
  */
 @Override
 public Connection getConnection() throws SQLException {
   try {
     return this.dataSourceToUse.getConnection();
   } catch (SQLException ex) {
     JDBCExceptionReporter.logExceptions(ex);
     throw ex;
   }
 }
コード例 #2
0
 /**
  * This implementation calls {@link DataSourceUtils#doCloseConnection}, checking against a {@link
  * org.springframework.jdbc.datasource.SmartDataSource}.
  */
 @Override
 public void closeConnection(Connection con) throws SQLException {
   try {
     DataSourceUtils.doCloseConnection(con, this.dataSourceToUse);
   } catch (SQLException ex) {
     JDBCExceptionReporter.logExceptions(ex);
     throw ex;
   }
 }
 public void release() throws SQLException {
   // we only release the connection
   if (connection != null) {
     JDBCExceptionReporter.logAndClearWarnings(connection);
     if (toggleAutoCommit) {
       connection.setAutoCommit(false);
     }
     provider.closeConnection(connection);
     connection = null;
   }
 }
コード例 #4
0
 private void closeConnection() {
   try {
     if (statement != null) statement.close();
     if (connection != null) {
       JDBCExceptionReporter.logWarnings(connection.getWarnings());
       connection.clearWarnings();
       connectionProvider.closeConnection(connection);
       connectionProvider.close();
     }
   } catch (Exception e) {
     System.err.println("Could not close connection");
     e.printStackTrace();
   }
 }