当我执行
rs.last();
rs.getRow();
系统报错:javax.servlet.ServletException: Result set type is TYPE_FORWARD_ONLY
可是我已将resultset设为ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE了,为什么还出错?我是用jdbc-odbc桥来连接数据库的,应该是支持jdbc2.0的,我不知道是什么原因,还望多多指教。除这以外,还有其它的方法能取得记录集中的记录数目吗?
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = stmt.executeQuery("SELECT a, b FROM TABLE2");
// rs will be scrollable, will not show changes made by others,and will be updatable
rs.absolute(5);
// moves the cursor to the fifth row of rs
rs.updateString("NAME", "AINSWORTH");
// updates the NAME column of row 5 to be AINSWORTH
rs.updateRow();
// updates the row in the data source
rs.moveToInsertRow();
// moves cursor to the insert row
rs.updateString(1, "AINSWORTH");
// updates the first column of the insert row to be AINSWORTH
rs.updateInt(2,35);
// updates the second column to be 35
rs.updateBoolean(3, true);
// updates the third row to true