private void closeQuery(ResultSet resultSet, PreparedStatement statement) {
    try {
      if (resultSet != null) {
        resultSet.close();
      }
      if (statement != null) {
        statement.close();
      }
    } catch (SQLRecoverableException e) {
      conn.resetConnection(e);
    } catch (SQLException e) {
      LOG.warn("Failed to close query", e);
    }
  }