aspose file tools
The moose likes JDBC and Relational Databases and the fly likes Comparing Password Problem in jdbc? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Comparing Password Problem in jdbc?" Watch "Comparing Password Problem in jdbc?" New topic
Author

Comparing Password Problem in jdbc?

Rosewell
Greenhorn

Joined: Jul 22, 2002
Posts: 8
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

Joined: Mar 06, 2001
Posts: 13459

"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
 
Don't get me started about those stupid light bulbs.
 
subject: Comparing Password Problem in jdbc?
 
It's not a secret anymore!