This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Passed ResultSet is not working  RSS feed

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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..

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!