Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1.     public boolean login(String actEmail, String actPassword){
  2.         String sql = "SELECT Email AND Password FROM volontari WHERE Email = ? AND Password = ?";
  3.         ResultSet res = null;
  4.  
  5.  
  6.         try (Connection conn = connector.getConnection();
  7.              PreparedStatement stmt = conn.prepareStatement(sql)) {
  8.  
  9.             stmt.setString(1, actEmail);
  10.             stmt.setString(2, actPassword);
  11.             stmt.executeQuery();
  12.  
  13.             if (res == null){
  14.                 return true;
  15.             }else
  16.             return false;
  17.  
  18.  
  19.         } catch (SQLException ex) {
  20.             System.out.println(ex.getMessage());
  21.         }
  22.          finally {
  23.             try {
  24.                 if (res != null) res.close();
  25.             } catch (SQLException e) {
  26.                 System.out.println(e.getMessage());
  27.             }
  28.         }return false;
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement