File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC 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
JavaRanch » Java Forums » Databases » JDBC
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Comparing Password Problem in jdbc?