Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

resultset next() returns false and yet record(s) exist

 
Zeko Mbumwae
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using oracle.jdbc.driver.OracleDriver (odbc14.jar with all oracle.dbtool plugins for eclipse installed).My resultset.next() returns false.
I alternatively tried to use OracleCachedRowSet but getRows() finds zero records too.My code is below
Please help am stuck on this.

Thanks.


 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34084
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Zeko,
Does "Select username,password AS num from mjzeko.users where username= ? AND password= ?" return any rows if you run it at the commandline? If so, double check the username/password are the same case as in the database and don't contain any extra whitespace.
 
Zeko Mbumwae
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The SQL Statement is OK and returns rows...Even just SELECT * FROM USERS will not make res.next() return true.

Thanks for the reply....Help!
 
Jan Cumps
Bartender
Posts: 2584
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have already called res.next() in line 21 before starting the while loop.

Regards, Jan
 
Zeko Mbumwae
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jan,
Thanks for the reply and noticing that unnecessary res.next(). Looks like it was the culprit.After so many issues I changed my code as below.It works well now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic