Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void getSupplierOfCoffee(String coffeeName, String[] supplierName)
- throws SQLException {
- Connection con = DriverManager.getConnection("jdbc:default:connection");
- PreparedStatement pstmt = null;
- ResultSet rs = null;
- String query =
- "select SUPPLIERS.SUP_NAME " +
- "from SUPPLIERS, COFFEES " +
- "where " +
- "SUPPLIERS.SUP_ID = COFFEES.SUP_ID " +
- "and ? = COFFEES.COF_NAME";
- pstmt = con.prepareStatement(query);
- pstmt.setString(1, coffeeName);
- rs = pstmt.executeQuery();
- if (rs.next()) {
- supplierName[0] = rs.getString(1);
- } else {
- supplierName[0] = null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement