Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

resultset

 
Sachin Raju
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to place the cursor of the rs to the initial position after completing the full iteration of the rs using while.next(). I tried using first() method but gettiing sqlexception : ResultSet may only be accessed in a forward direction.
 
Rok Ć telcer
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Sachin Bobz wrote:How to place the cursor of the rs to the initial position after completing the full iteration of the rs using while.next(). I tried using first() method but gettiing sqlexception : ResultSet may only be accessed in a forward direction.

From the API call:
SQLException - if a database access error occurs or the result set type is TYPE_FORWARD_ONLY

So, for solution click here.


Regards,
Rok
 
Sachin Raju
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using the "net.sourceforge.jtds.jdbc.Driver" to connect to the sql server. I tried to use scrollable resultset since I was to use rs for many times in my program. I am getting this exception while going through the rs. Please suggest.




I have changed the rs to the scrollable one. When I iterate through the rs object I am getting different exception..

java.sql.SQLException: No current row in the ResultSet.
at net.sourceforge.jtds.jdbc.MSCursorResultSet.getColumn(MSCursorResultSet.java:248)
at net.sourceforge.jtds.jdbc.JtdsResultSet.getString(JtdsResultSet.java:930)
at net.sourceforge.jtds.jdbc.JtdsResultSet.getString(JtdsResultSet.java:1217)
at DB2.getDetails(DB_PDF_Generator.java:222)
at DB_PDF_Generator.main(DB_PDF_Generator.java:107)
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does your query return any results?
 
Sachin Raju
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its working
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic