aspose file tools*
The moose likes JDBC and the fly likes How to get the rowCount, and also ResultSet.last() in JDBC? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to get the rowCount, and also ResultSet.last() in JDBC?" Watch "How to get the rowCount, and also ResultSet.last() in JDBC?" New topic
Author

How to get the rowCount, and also ResultSet.last() in JDBC?

liang gu
Ranch Hand

Joined: Nov 05, 2001
Posts: 89
I basically have 2 questions?
1) First, how to get the total row count of a result set without looping through the whole result set?
2) I have the following code:
conn = dataSource.getConnection();
CallableStatement stmt = null;
stmt = conn.prepareCall("BEGIN " + "MyStoredProcedure" + "(?); END;");
stmt.registerOutParameter(1, OracleTypes.CURSOR);
stmt.execute();
ResultSet rs = (ResultSet) stmt.getObject(1);
rs.last() //gives Exception here
When these statements executed, I got SQLException on rs.last(). I have tried to use setFetchDirection() method on rs and stmt, but without any luck.
I urgently need help! Thanks for help!
Liang
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get the rowCount, and also ResultSet.last() in JDBC?