Guest User

Untitled

a guest
Jul 26th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. How to validate username from MySql with JSP
  2. un//be the variable where username entered now from html form is stored
  3.  
  4. uname //column name in mysql for usernames
  5. user //table name in mysql
  6.  
  7. Connection con = DriverManager.getConnection("jdbc:mysql://localhost/mebps","root","admin");
  8. Statement stmt = (Statement) con.createStatement();
  9. ResultSet rs = stmt.executeQuery("select un from userinfo");
  10.  
  11. while(rs.next())
  12. {
  13. if(rs.getString("uname") == un)
  14. {
  15. out.println("user is present");
  16. }
  17. }
Add Comment
Please, Sign In to add comment