• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Passed ResultSet is not working

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Dear Experts,
In my application I have a method that takes a resultSet -which is already retrieved from a perfect-working query and statement- object through its parameters, and then take the required fields from this resultSet,but that's not working...
check out my code please..

This is where I create the ResultSet in the first place and returns the
indexes I want (This next method is working perfectly):


Now the method that takes the resultSet created from the previous one and the index number to get a wanted record from the resultSet as next:


This way of dealing with ResultSet I've read so many times that it's the best way to deal with big resultSet records because passing resultSet through session is better then assigning the values of resultSet to a vector (for example) and send this vector over session which will give OutOfMemory Exception..
any suggestions...
thanks in advanced..
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
rs.getRow() would return 0.
rs.absolute(rowIndex)) would place your cursor between the last and the first record (assuming rowIndex = rs.getRow()).

Now, since your cursor is between the last and first row i.e. your cursor not there on any row, rs.getInt("columnName"); would throw an SQLException.

May you can try using rs.first() before rs.getRow() and then execute the exact same code again.
 
Qussay Najjar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Prashant:
rs.getRow() would return 0.

No, rs.getRow() is not giving back 0 it's working fine and giving the right index I want I've checked it out..

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic