加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

在Java 7中关闭ResultSet

发布时间:2020-12-14 16:31:27 所属栏目:Java 来源:网络整理
导读:参见英文答案 Must JDBC Resultsets and Statements be closed separately although the Connection is closed afterwards?8个 以下站点显示了使用JDBC的新“AutoClosable”功能: link.此站点显示了语句将如何自动关闭,但结果集不在try()部分中,它将自动关
参见英文答案 > Must JDBC Resultsets and Statements be closed separately although the Connection is closed afterwards?8个
以下站点显示了使用JDBC的新“AutoClosable”功能: link.此站点显示了语句将如何自动关闭,但结果集不在try()部分中,它将自动关闭.所以,我的问题是,我不需要直接在Java 7中关闭ResultSet吗?我一直使用模式:close resultset,close语句,close连接.

解决方法

从 Javadoc of ResultSet:

A ResultSet object is automatically closed when the Statement object that generated it is closed,re-executed,or used to retrieve the next result from a sequence of multiple results.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读