Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passed ResultSet is not working

 
Qussay Najjar
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..
 
Prashant Ladha
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