This week's book giveaways are in the iOS and Features new in Java 8 forums.
We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and Relational Databases and the fly likes unexpected output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "unexpected output" Watch "unexpected output" New topic
Author

unexpected output

Amritpal Singh Moomie
Ranch Hand

Joined: Sep 24, 2010
Posts: 32
HI I am trying to create a user check method by accessing database for my jsf application.
Can anybody tell me why i am getting login (i.e success output ) from code even when i enter wrong loginname and password?

Amritpal Singh Moomie
Ranch Hand

Joined: Sep 24, 2010
Posts: 32
I am trying to check whether the resultset is null or not?
If its null that is there is no record like that means fail (no login)
and if its not null that is success( successfull login)
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

ResultSets are never null. They are empty sometimes though...


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Amritpal Singh Moomie
Ranch Hand

Joined: Sep 24, 2010
Posts: 32
so how can i check that there is no record for that query?
or it is empty
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Have a look at the ResultSet JavaDocs. You should see the method available to you. Alternatively you could change your sql to count the number of users that match your search criteria and check that.
Amritpal Singh Moomie
Ranch Hand

Joined: Sep 24, 2010
Posts: 32
thanks for the help
I figured out how to do it




 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unexpected output