Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static boolean validateUser( String username, String pass)
- {
- boolean found = false;
- Connection c = DBHelperClass.getConnection();
- if(c!=null)
- {
- try
- {
- String template = "SELECT * from users where username=? and password=?";
- PreparedStatement inserter = c.prepareStatement(template);
- inserter.setString(1, username);
- inserter.setString(2, pass);
- ResultSet resultSet = inserter.executeQuery();
- if (resultSet != null)
- {
- found = true;
- }
- }
- catch (SQLException ex)
- {
- Logger.getLogger(User.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- return found;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement