Again i (=
As though authorization, i check on presence of record in db. Why that i do not receive the necessary result. Prompt in what a problem. Thankful in advance.
In db the table users a kind: |id|acc|pswd |...|

==================
public class DrugstoreFrame extends JFrame {
    MsAcDatabase database;
    Client person = new Client();
...
 public void jButton3_mouseClicked(MouseEvent e) {

     try{
         database.findPersonAccPswd(getClientAcc());
          if(person != null){
              if(person.getPassword().equals(getClientPswd()))
              {
                  cardLayout1.show(jPanel7, "jPanel4");
              }
              else {
                  pane.showMessageDialog(contentPane, "You have entered not the correct password !");
              }
          }
          else{
              pane.showMessageDialog(contentPane, "You haven't register!");
          }

     } catch(DataAccessException exception){

     }

 public String getClientAcc(){
       String acc = getField(jTextField2);
       return acc;
    }
    public String getClientPswd(){
        String pswd = getField(jPasswordField1);
        return pswd;
    }
 private String getField(JTextField field){
        return field.getText();

    }
...
}
========================
package drugstore;
public class MsAcDatabase implements ClientDataAccess{
    private Connection connection;
    private PreparedStatement sqlFindAccPswd;
    ....
 public MsAcDatabase() throws Exception {
        connect();
    sqlFindAccPswd = connection.prepareStatement(
                "SELECT acc FROM users WHERE acc = ? ");
 }

public Client findPersonAccPswd(String account) throws DataAccessException {
        try{
            sqlFindAccPswd.setString(1, account);
            ResultSet resultSet = sqlFindAccPswd.executeQuery();
            if(!resultSet.next())
                return null;
            Client person = new Client();
            person.setAccount(resultSet.getString(1));
            person.setPassword(resultSet.getString(2));
            return person;
        } catch(SQLException sqlException) {
            return null;
        }

    }
}

===============================
package drugstore;
public class Client {
    private String account = "";
        private String password = "";
    ...
    public void setAccount(String account){
        this.account = account;
    }
    public void setPassword(String password){
        this.password = password;
    }
}

What is "the necessary result"?

Are you getting compile errors? If so post them.

Are you getting runtime errors? If so, post them.

Are the results you are getting something different from what you expect? If so, post exactly what it is expect, and, exactly what it is you are getting.

What is "the necessary result"?

Are you getting compile errors? If so post them.

Are you getting runtime errors? If so, post them.

Are the results you are getting something different from what you expect? If so, post exactly what it is expect, and, exactly what it is you are getting.

Let I have such records in base.
|...| acc | pswd |...|
=============
|...|User|Pass |...|

I have jTextField, jPasswordField. When I enter there the information (User/Pass) should receive result - null if record does not exist it ...
It's possible to track in a code which I have resulted.

At this spot in the code:

person.setAccount(resultSet.getString(1));
person.setPassword(resultSet.getString(2));

insert above that

System.out.println("Results:  "resultSet.getString(1) + ":::::" + resultSet.getString(2));

That way you can take a peek at what has been returned. If no "Results" line is printed, then nothing has been found.

I have Found the error,
sqlFindAccPswd = connection.prepareStatement(
"SELECT acc, pswd FROM users WHERE acc = ? ");


Your line of code help me to track where programm ceased to work (=

This article has been dead for over six months. Start a new discussion instead.