What happens if i don\'t close resultset or preparedstatements.
Will they be closed and released by the garbage collector.
I\'m asking this for local variabl
if i don't close result set or prepared statements.Will they be closed and released by the garbage collector.
resultset and preparedstatment are closed ,by explicitly calling close method. Garbage collector will not close these. I you do not call close , then the oracle cursor is not released at the oracle end.
Will they be released by the garbage collector.
Generally an object becomes eligible for garbage collection in Java on following cases:
for your question : I'm asking this for local variables inside a function.
ResultSet Object created inside a method, not closed and reference goes out scope ,once control exit that method . , then the reference is set to null and object is eligible for garbage collection. I did say eligible not guaranteed.The underlying oracle cursor is still there in the database.because u did not call close.