I have a derby users database which I query, when the user clicks login on the application.
However, when I query the users table with the parameter [user] derby returns a null Object instead of the record it ought to return.
Here is my code:
String ssql = "SELECT * FROM USERS WHERE UNAME LIKE ?";
   try{
       DriverManager.registerDriver(new org.apache.derby.jdbc.EmbeddedDriver());
       con = DriverManager.getConnection(url);
       sql = con.prepareStatement(ssql, Statement.RETURN_GENERATED_KEYS);
       sql.setString(1, cbox_chooseUser.getSelectedItem().toString());
       sql.executeQuery();
       ResultSet rs = sql.getGeneratedKeys();
           try{
              while (rs.next()) {
                 if(rs.getString("PW").toCharArray().equals(txt_password.getPassword())){
                     sql.close();
                     con.close();
                     return true;
                  }
             } catch (NPE ...) {...}
    }
I tried it multiple times wit a test user with both the pw and the username set to "test"; but I always get the same error. Why is the recordset always Null?
Thanks for your help :)
 
     
    