This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC 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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
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
 
Similar Threads
need to transfer productID from url to action class in struts 2
Result set
Can anyone help me with this error
jsf and database connection problem
java.sql.SQLException: No suitable driver