I have a project with JDBC connectivity (JAVA-MYSQL) which has a login up form. But the coding doesn't work.(meaning it always shows "WRONG PASSWORD" though I'm sure its the right one).
Please find the error. (cause it shows none).
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String S;
String email = jTextField3.getText();
try {
Class.forName("java.sql.Driver");
Connection con = DriverManager.getConnection("jdbc:Mysql://localhost/nami", "root", "123456");
Statement st = con.createStatement();
S = "SELECT password FROM signup WHERE email =" + "'" + email + "'" + ";";
st.executeQuery(S);
String pass = new String(jPasswordField2.getPassword());
if (pass.equals("S")) {
jOptionPane1.showMessageDialog(null, "YOU HAVE SUCCESSFULLY LOGGED IN");
MAINPAGE at = new MAINPAGE();
jDesktopPane1.add(at);
at.show();
} else {
jOptionPane1.showMessageDialog(null, "WRONG PASSWORD!!");
}
} catch (Exception e) {
jOptionPane2.showMessageDialog(null, "Error" + e.getMessage());
}
}