Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "Connection authentication failure occurred. Reason: Userid or password invalid."
- public static void CoLogin(String username, String password){
- try{
- String dbuser = "";
- String dbpass = "";
- String url = "jdbc:derby://localhost:1527/Java-App";
- String user = username;
- String pass = password;
- Connection con = DriverManager.getConnection(url, "admin", "admin");
- Statement stmt = con.createStatement();
- String SQL = "SELECT * FROM MEMBERS WHERE ID='" + user + "' && PASSWORD='" + pass + "'";
- ResultSet rs = stmt.executeQuery(SQL);
- while(rs.next()){
- dbuser= rs.getString("ID");
- dbpass = rs.getString("PASSWORD");
- }
- if(user.equals(dbuser) && pass.equals(dbpass)){
- Main x = new Main();
- x.setVisible(true);
- }
- else{
- Login x = new Login();
- x.setVisible(true);
- }
- //Connection con = DriverManager.getConnection(url, user, pass);
- }
- catch(SQLException error){
- System.out.println(error.getMessage());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement