public String getPurchaserEmailAddress(int orderId) throws SQLException { Connection connection = null; try { String email = null; connection = ConnectionPool.getConnection(); String query = "SELECT email FROM orders WHERE order_id = ?"; PreparedStatement emailQuery = connection.prepareStatement(query); emailQuery.setInt(1, orderId); ResultSet rs = emailQuery.executeQuery(); if ( rs.next() ) { email = rs.getString(1); } return email; } finally { ConnectionPool.freeConnection(connection); } }