dcsimg
Does every ResultSet need to be closed?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Martin_Borg
Posted On:   Tuesday, July 30, 2002 11:40 AM

What happen if you forget to close a ResultSet?

Will the ResultSet be closed when the Statement that

produced it is closed or when the connection is closed ?

I am using the MM-Mysql JDBC-driver.



Do you think it is necessary to use a try - catch - finally to ensure that

Statements and ResultSets is closed or is it ok to close in the end of

the try block (which would not be executed in case of an error in query)

Re: Does every ResultSet need to be closed?

Posted By:   Benoit_Quintin  
Posted On:   Tuesday, July 30, 2002 12:24 PM

Well you definitely should close every resource in the finally block. As far as ResultSets are concerned, I think that when you close a Statement, it,s opened resultsets are automatically closed too, but just to be on the safe side (in case some other developer decides to re-use some of you stuff) I think it's better to close the resultset when you don't need it anymore... (returns the DB resources for some other use and does free up a bit of memory, doesn't it??)
About | Sitemap | Contact