Guest User

Untitled

a guest
Nov 27th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. public static Boolean userLogin(String username, String password) throws Exception {
  2. Boolean bool = null;
  3. try{
  4. Connection con = getConnection();
  5. PreparedStatement query = con.prepareStatement("SELECT * FROM users WHERE Username=? AND Password=?");
  6. query.setString(1, username);
  7. query.setString(2, password);
  8.  
  9. ResultSet result = query.executeQuery();
  10.  
  11. if(result.next()) {
  12. bool = true;
  13. }
  14.  
  15. } catch(Exception e) {
  16. System.out.println(e);
  17. }
  18. return bool;
  19. }
Add Comment
Please, Sign In to add comment