Operation not allowed after ResultSet closed--操作mysql数据库
2016-08-01 14:45
441 查看
一个stmt多个rs进行操作.那么从stmt得到的rs1,必须马上操作此rs1后,才能去得到另外的rs2,再对rs2操作.不能互相交替使用,会引起rs已经关闭错误——Operation not allowed after ResultSet closed.
正确的代码:
一个stmt最好对应一个rs, 如果用一个时间内用一个stmt打开两个rs同时操作,会出现这种情况.编写这样的代码的操作原则是:
所以解决此类问题:
1.就多创建几个stmt,一个stmt对应一个rs;
2.若用一个stmt对应多个rs的话,那只能得到一个rs后就操作,处理完第一个rs后再处理其他的,如上"正确代码".
所以解决此类问题:
1.就多创建几个stmt,一个stmt对应一个rs;
2.若用一个stmt对应多个rs的话,那只能得到一个rs后就操作,处理完第一个rs后再处理其他的,如上"正确代码".
相关文章推荐
- Operation not allowed after ResultSet closed--操作mysql数据库
- Operation not allowed after ResultSet closed--操作mysql数据库
- 数据库操作错误之“Operation not allowed after ResultSet closed”
- Operation not allowed after ResultSet closed
- MySQL 错误:Operation not allowed after ResultSet closed
- JDBC:报错-Operation not allowed after ResultSet closed(一)
- 学习小记——Operation not allowed after ResultSet closed
- 错误:Operation not allowed after ResultSet closed
- SQLExecption:Operation not allowed after ResultSet closed解决办法
- Java学习笔记:Exception:Operation not allowed after ResultSet closed
- Operation not allowed after ResultSet closed
- Operation not allowed after ResultSet closed 错误的解决方案
- java.sql.SQLException: Operation not allowed after ResultSet closed
- Operation not allowed after ResultSet closed
- Caused by: java.sql.SQLException: Operation not allowed after ResultSet closed
- java.sql.SQLException: Operation not allowed after ResultSet closed
- 错误:Operation not allowed after ResultSet closed
- Operation not allowed after ResultSet closed
- mySql错误: java.sql.SQLException: Operation not allowed after ResultSet closed
- Operation not allowed after ResultSet closed--Mysql