java.sql.SQLException: ResultSet is closed 的一种解决
2006-05-13 14:07
1696 查看
碰到这个问题应该不是第一次了,现在才知道其中的一个原因。
我在关闭数据库时,总是习惯性地只关闭ResultSet,并且认为那样的话,connnection and statement也会自动关闭的。而事实是,正好相反,JDBC的层次是,Connection一旦关闭,其他两个就自动关闭了。
这个与我之前看到的有关IO操作的的值是发生了冲突。因为我记得,在IO中,如果用BufferReader包装InputStream的话,BufferedReader一旦关闭,其包装的InputStream也自动关闭。这里,InputStream是底层,BufferedReader是上层。
(http://community.csdn.net/Expert/topic/4749/4749076.xml?temp=.7548029)
我在关闭数据库时,总是习惯性地只关闭ResultSet,并且认为那样的话,connnection and statement也会自动关闭的。而事实是,正好相反,JDBC的层次是,Connection一旦关闭,其他两个就自动关闭了。
这个与我之前看到的有关IO操作的的值是发生了冲突。因为我记得,在IO中,如果用BufferReader包装InputStream的话,BufferedReader一旦关闭,其包装的InputStream也自动关闭。这里,InputStream是底层,BufferedReader是上层。
(http://community.csdn.net/Expert/topic/4749/4749076.xml?temp=.7548029)
相关文章推荐
- java.sql.SQLException: ResultSet is closed解决方法
- java.sql.SQLException: ResultSet is closed解决方法
- java.sql.SQLException: ResultSet is closed解决方法
- Java错误提示-------java.sql.SQLException:ResultSet is closed
- 解决mysql java.sql.SQLException: The server time zone value‘XXXXXX' is unrecognized or represents...
- shiro连接mysql数据库报错java.sql.SQLException: The server time zone value '�й���ʱ��' is unrecognize...解决
- 【转】java.sql.SQLException: statement is closed语句被关闭 druid连接池报错
- 解决java.sql.SQLException: Parameter number X is not an OUT parameter
- java.sql.SQLException: Connection is closed
- java.sql.SQLException: statement is closed语句被关闭 druid连接池报错
- mySql错误: java.sql.SQLException: Operation not allowed after ResultSet closed
- 解决java.sql.SQLException: Parameter number X is not an OUT parameter
- java.sql.SQLException: null, message from server: “Host ‘xxx’ is not allowed to connect异常解决
- Caused by: java.sql.SQLException: Operation not allowed after ResultSet closed
- 解决java.sql.SQLException: Parameter number X is not an OUT parameter--转
- java.sql.SQLException: Operation not allowed after ResultSet closed
- Mabatis报错 java.sql.SQLException: Parameter number 3 is not an OUT parameter 解决方法
- Cause: java.sql.SQLException: JZ0C0: Connection is already closed
- java.sql.SQLException: Operation not allowed after ResultSet closed
- Caused by: java.sql.SQLException: ResultSet is from UPDATE. No Data.