How to get the rowCount, and also ResultSet.last() in JDBC?
posted 14 years ago
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