Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. private static final long serialVersionUID = 1L;
  2.  
  3. public static boolean validate(String username,String password,String npass) {
  4.  
  5. boolean status = false;
  6. ChangePass cp = new ChangePass();
  7. try {
  8. Connection con = DBConnection.getConnection();
  9. PreparedStatement ps = con.prepareStatement("select * from doctable where username=? and password=?");
  10.  
  11. ps.setString(1, username);
  12. ps.setString(2, password);
  13.  
  14. ResultSet rs= ps.executeQuery();
  15. status = rs.next();
  16. if(true) {
  17. PreparedStatement ps1 = con.prepareStatement("update details set password=? where username=?");
  18. ps1.setString(1, cp.getNpass());
  19. ps1.setString(2, cp.getUsername());
  20. ps1.executeUpdate();
  21. }
  22. }
  23.  
  24. catch (Exception ex) {
  25. ex.printStackTrace();
  26.  
  27. return status;
  28. }
  29. return status;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement