Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- public class validate
- {
- public static boolean checkUser(String email,String pass)
- {
- boolean st =false;
- try{
- //loading drivers for mysql
- Class.forName("com.mysql.jdbc.Driver");
- //creating connection with the database
- Connection con=DriverManager.getConnection
- ("jdbc:mysql://localhost:3306/test2","root","sa");
- PreparedStatement ps =con.prepareStatement
- ("select * from user_tbl where email=? and pass=?");
- ps.setString(1, email);
- ps.setString(2, pass);
- ResultSet rs =ps.executeQuery();
- st = rs.next();
- }catch(Exception e)
- {
- e.printStackTrace();
- }
- return st;
- }
- }
Add Comment
Please, Sign In to add comment