• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Comparing Password Problem in jdbc?

 
Rosewell
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Guys;
All of you have been a great help to me, well as of now I'm with a problem in comparing the password from the databse with the user input password. Can anyone pls. help me, thanks.
Problem :
When the program accepts the user input, it doesn take out the splash screen or if the password is not correct it doesnt throw a JOptionPane, error message.
Here is the dummy :
final JPasswordField password = new JPasswordField(10);
JButton accept = new JButton();
// already assuming that it is already with the JFrame //
accept.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)
{
try {
Statement statement = connect.createStatement();
// . . . . Here is the problem . . . . //
String query = "SELECT Password, FROM id ";

ResultSet rs = statement.executeQuery( query );
String result = "" + password.getPassword();
if( query == result ) {
Splash time = new Splash();
dispose();
}
else
{
JOptionPane.showMessageDialog(null,"Incorrect Password . . .",
"Warning . . .",JOptionPane.WARNING_MESSAGE);
tryme++;
if( tryme >= 3 )
{
JOptionPane.showMessageDialog(null,"Your not a valid user . . .",
"Error . . .",JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
}
statement.close();
}
catch ( SQLException sqlex ) {
sqlex.printStackTrace();
}
}
});
}
God Speed . . .
[ February 03, 2003: Message edited by: Rosewell ]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Rosewell"
You now have 8 posts with an invalid display name and it won't be long till your account is deleted
Please edit your display name to comply with the JavaRanch naming policy soon.
thanks,
Dave
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic