mysql中现在还有很多jdbc2.0中规定的特性(feature)没有支持。大家等待他的改进吧。但是就目前而言,如mm.mysql.jdbc-2.0pre5中是有对这个的支持的。 /** * JDBC 2.0 * * <p>Moves to the last row in the result set. * * @return true if on a valid row, false if no rows in the result set. * @exception SQLException if a database-access error occurs, or * result set type is TYPE_FORWARD_ONLY. */ public synchronized boolean last() throws SQLException {
但是你要设置ResultSet的属性, 如: PreparedStatement pstmt = con.prepareStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); // rs will be scrollable, will not show changes made by others, // and will be updatable
* JDBC 2.0
*
* <p>Moves to the last row in the result set.
*
* @return true if on a valid row, false if no rows in the result set.
* @exception SQLException if a database-access error occurs, or
* result set type is TYPE_FORWARD_ONLY.
*/ public synchronized boolean last() throws SQLException
{
if (Rows.size() == 0) {
return false;
}
else {
if (_on_insert_row) {
_on_insert_row = false;
} if (_doing_updates) {
_doing_updates = false;
} currentRow = Rows.size() - 1;
This_Row = (byte[][])Rows.elementAt(currentRow); return true;
}
}
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
// rs will be scrollable, will not show changes made by others,
// and will be updatable