• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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);
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!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!