求javafx与数据库已经建立连接但是总是出现查询出错的问题该怎么解决

是个java小白,这里是部分代码,希望有大佬可以帮帮我

img

public int userQuery(String user,String password) {
try {
String selectSql="SELECT id FROM Users WHERE sName=? AND password=?";
ps=conn.prepareStatement(selectSql);
ps.setString(1,"hhd");
ps.setString(2,"123123");
ResultSet rs=ps.executeQuery();
if(rs.next()) {
return rs.getInt(1);
}
else
return 0;
}catch(SQLException se) {
se.printStackTrace();
return -1;
}finally {
try {
System.out.println(conn);
if (conn != null)
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}

}

public class Service {
private static DataOperator dataOperate=new DataOperator();
public static int login(String user,String password) {
dataOperate.loadDatabaseDriver();
dataOperate.connect();
//dataOperate.addSuperUser();
return dataOperate.userQuery(user,password);
}
public static void quit() {
dataOperate.disconnect();
}
}
bt.setOnAction((ActionEvent event)->{
String user=tf.getText().trim();
String password=pf.getText().trim();
int id;
if((id=Service.login(user, password))==1){
BooksManager open=new BooksManager();
open.start(new Stage());
primaryStage.close();
Service.quit();

            }
                else if(id==0) {
                    Alert alert=new Alert(AlertType.ERROR);
                    alert.setTitle("ERROR");
                    alert.setContentText("用户名或密码错误");
                    alert.showAndWait();
                    primaryStage.close();
                }
                else {
                    Alert alert=new Alert(AlertType.ERROR);
                    alert.setTitle("ERROR");
                    alert.setContentText("查询错误");
                    alert.showAndWait();
                    primaryStage.close();
                }
                
        });