java.sql.SQLException: 对只转发结果集的无效操作: absolute beforeFirst
2007-01-26 14:46
381 查看
java.sql.SQLException: 对只转发结果集的无效操作: absolute beforeFirst | |||
| |||
java.sql.SQLException: 对只转发结果集的无效操作: absolute,beforefirst 按缺省方法打开的ResultSet,其Cursor type 为forward only,也就是说只能向后执行next(),执行到最后一条记录就结束了。 有两个方法解决: 1。 重新打开ResultSet,也就再一次执行executeQuery(),这时cursor又回到开头,可以再次执行next(); 2。 指定按可滚动的方式打开ResultSet: Statement stmt = con.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = stmt.executeQuery(...); 按上面的方式打开的ResultSet,Cursor type为scrollable,可以调用absolute()方法。 从你说明的情况看,如果不是真正需要随机访问,采用第一种方法更合适。因为可滚动光标库相对于仅向前光标库来说,其开销是很大的。 |
相关文章推荐
- java.sql.SQLException: 对只转发结果集的无效操作: last
- java.sql.SQLException: 对只转发结果集的无效操作: last异常解决
- java.sql.SQLException: 对只转发结果集的无效操作: last
- java.sql.SQLException: 对只转发结果集的无效操作: last
- java.sql.SQLException: 对只读结果集的无效操作
- 对只转发结果集的无效操作:last,absolute
- "对只转发结果集的无效操作: first" - 异常
- java.sql.SQLException: ORA-00911: 无效字符 解决方法
- 对只转发结果集的无效操作:last
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名 ‘xxx’ 无效
- Caused by: java.sql.SQLException: ORA-00911: 无效字符
- ibatis java.sql.SQLException:列名无效
- [转]java.sql.SQLException: 无效的列索引
- java.sql.SQLException: 无效的列索引
- java.sql.SQLException: ORA-00911: 无效字符 解决方法
- java.sql.SQLException: ORA-00911: 无效字符
- java.sql.SQLException: 无效的列索引
- SSM报错:java.sql.SQLException: 无效的列类型: 1111
- Error querying database. Cause: java.sql.SQLException: ORA-00911: 无效字符
- java.sql.SQLException: 无效的列索引