【六袆-Bug】Operation not allowed after ResultSet closed

【六袆-Bug】Operation not allowed after ResultSet closed 

error:

当我循环下载图片的时候,执行一次就退出来了,然后捕获异常,发现报 java.sql.SQLException: Operation not allowed after ResultSet closed

【六袆-Bug】Operation not allowed after ResultSet closed 

然后于是Google一下 错误,

【六袆-Bug】Operation not allowed after ResultSet closed

 

 出现这种问题是

一个stmt多个rs进行操作引起的ResultSet已经关闭错误

一个stmt最好对应一个rs, 如果用一个时间内用一个stmt打开两个rs同时操作,会出现这种情况.


所以解决此类问题:

1.就多创建几个stmt,一个stmt对应一个rs;

2.若用一个stmt对应多个rs的话,那只能得到一个rs后就操作

 

 

 

 由此一来,解决了

【六袆-Bug】Operation not allowed after ResultSet closed

 

 借鉴参考:https://blog.csdn.net/sku0923/article/details/1722370