Advertisement
Guest User

Untitled

a guest
Apr 5th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. @Override
  2. public boolean login(String username, String password) throws RemoteException {
  3. boolean b = false;
  4. try {
  5. Connection db_con = databaseConnection();
  6. Statement stmt = db_con.createStatement();
  7. String sql = "SELECT * FROM books_db.user WHERE user_id = '" + username + "' and status = 'active'";
  8.  
  9. ResultSet rs=stmt.executeQuery(sql);
  10.  
  11. String checkusername = rs.getString(1);
  12. String checkpassword = rs.getString(2);
  13.  
  14. if (checkusername.equals(username) && checkpassword.equals(password)) {
  15. b = true;
  16. } else {
  17. b = false;
  18. }
  19.  
  20. } catch (Exception e) {
  21. }
  22. return b;
  23. }
  24.  
  25. public boolean login(String username, String password) throws RemoteException;
  26.  
  27. Message impl = (Message) myRegistry.lookup("asd");
  28. String u = "20160001";
  29. String p = "p";
  30. boolean r = impl.login(u, p);
  31.  
  32. if (r == true) {
  33. System.out.println("success");
  34. } else {
  35. System.out.println("fail");
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement