From the javadocs:html
When a Statement object is closed, its current ResultSet object, if one exists, is also closed.java
However, the javadocs are not very clear on whether the Statement and ResultSet are closed when you close the underlying Connection . They simply state that closing a Connection:sql
Releases this Connection object's database and JDBC resources immediately instead of waiting for them to be automatically released.apache
In my opinion, always explicitly close ResultSets , Statements and Connections when you are finished with them as the implementation of close could vary between database drivers.api You can save yourself a lot of boiler-plate code by using methods such as closeQuietly in DBUtilsfrom Apache.oracle #######總結########## 用完以後,最好顯示關閉掉這些資源。ui |