aspose file tools*
The moose likes JDBC and the fly likes Passed ResultSet is not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Passed ResultSet is not working" Watch "Passed ResultSet is not working" New topic
Author

Passed ResultSet is not working

Qussay Najjar
Ranch Hand

Joined: Jan 18, 2008
Posts: 53
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..


Qussay NAJJAR
Prashant Ladha
Greenhorn

Joined: Feb 06, 2008
Posts: 8
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

Joined: Jan 18, 2008
Posts: 53
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..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passed ResultSet is not working