public void closeConnections() throws SQLException { if (itemPreparedStatement != null) { itemPreparedStatement.close(); } if (itemConnection != null) { itemConnection.close(); } if (holdingsPreparedStatement != null) { holdingsPreparedStatement.close(); } if (holdingsConnection != null) { holdingsConnection.close(); } if (bibResultSet != null) { bibResultSet.close(); } if (bibStatement != null) { bibStatement.close(); } if (bibConnection != null) { bibConnection.close(); } if (connection != null) { connection.close(); } }
public String getTotalNoOfRecords() throws SQLException { String totalRecords = "0"; Connection connection = getConnection(); PreparedStatement preparedStatement = null; if (isStaffOnly) { preparedStatement = connection.prepareStatement(bibCountQuery); } else { preparedStatement = connection.prepareStatement(bibCountQuery + staffOnly); } ResultSet resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { totalRecords = resultSet.getString("totalRecords"); } preparedStatement.close(); resultSet.close(); connection.close(); return totalRecords; }