参见英文答案 >
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.

dawei

【声明】:淮南站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。