db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thornton <mthorn...@optrak.co.uk>
Subject Re: Why close ResultSet & PreparedStatement?
Date Sat, 29 Nov 2008 22:42:04 GMT
derby@segel.com wrote:
>> Amir Michail wrote:
>>     
>>> Hi,
>>>
>>> Is there any point in calling the close method on ResultSet and the
>>> close method of PreparedStatement?
>>>
>>> Amir
>>>
>>>
>>>       
>> You might later change the database to one where it matters much more.
>>
>> Mark Thornton
>>     
>
> Huh?
>
> I'm sorry but your answer doesn't make any sense.
>
> To answer Amir's question... you close the ResultSet and the
> PreparedStatements to remove any overhead as a result of their
> instantiation.
>
>   
The resources required by an open ResultSet depend on the implementation 
of the database and drivers. It is fairly low for embedded Derby but 
considerably higher for some other databases. If there is a chance that 
the database used may be replaced by something else (Oracle, SQL Server, 
etc), then being careful about closing objects like ResultSet can be 
more important.

I agree that the overhead of PreparedStatement's is usually not great.

Mark Thornton


Mime
View raw message