Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Can`t get info out of a Oracle db with java

 
serban ciofliceanu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I connected a Java to a Oracle XE all fine but when I try to get some info out it gives me this: Exhausted Resultset . How can I make it work ? Thanks
Here is the code:
 
Junilu Lacar
Marshal
Posts: 10355
123
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ResultSet.next() returns false if there is no record to read. You have to put your rs.getXXX() calls inside an if-statement that checks the result of next()--do it only if there is a valid record to read from.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!