What are the resources consumed by a left-open result set / statement if a statement is created before each query?
Are result sets / statements closed by the garbage collection in this case?
What are the resources consumed by a left-open result set / statement if a statement is created before each query?
Are result sets / statements closed by the garbage collection in this case?
There is a possibility that you may have consequences for without closing connection. maximum open cursors exceeded
exception you may get.
from Java doc
By default, only one ResultSet object per Statement object can be open at the same time. Therefore, if the reading of one ResultSet object is interleaved with the reading of another, each must have been generated by different Statement objects. All execution methods in the Statement interface implicitly close a statment's current ResultSet object if an open one exists.
So you need to close all JDBC resources explicitly.