> I've have a strange effect that I don't understand. > If the "fetchSize" of a result is smaller that the size of a > result and > I move the cursor position to last, ResultSet.getRow() returns -1. > But the cursor is on the right row if I look at the values in > the result.
In this case, the value -1 doesn't mean 'error', but 'end - 1'. After a ResultSet.previous (), .getRow () would return -2. This is consistent with .absolute (), calling this method with a negative parameter will position the ResultSet relative to the end of the database cursor. More often than not, the JDBC driver does not know the size of the ResultSet. .last () isn't implemented by calling .next () internally, but by sending a specific command to the database. So there is no reliable way to count the number of rows in a ResultSet. The driver does know the size of the ResultSet when all the rows fit into one communication packet. When using .setFetchSize (), the number of records is artificially limited. Daniel Dittmar -- Daniel Dittmar SAP DB, SAP Labs Berlin [EMAIL PROTECTED] http://www.sapdb.org/ _______________________________________________ sapdb.general mailing list [EMAIL PROTECTED] http://listserv.sap.com/mailman/listinfo/sapdb.general
