• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

resultset

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
does your query return any results?
 
Sachin Raju
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its working
 
Your mother was a hamster and your father was a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic