/**
  * 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;
   }
 }
 /**
  * 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;
   }
 }
 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();
   }
 }