db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lance J. Andersen" <Lance.Ander...@Sun.COM>
Subject Re: Derby-638 not actually resolved ?
Date Tue, 12 Dec 2006 15:08:50 GMT


Bernt M. Johnsen wrote:
> Hi,
>
> Some comments:
>
> 1) It is considered good parctice to clase all JDBC object when they
>    are not needed and free the underlying db resources as quicklya s
>    possible.
>
> 2) Closing connections before statements is obviously not correct but
>    probably harmless in most situations.
>   
This is not correct to do (calling Statement.close() after closing the 
Connection) and i would suggest avoiding this coding style.  Fortunately 
the JDBC spec requires a subsequent call to Statement.close() to be a 
no-op  when the Statement has already been closed but why do this at all?


> 3) I would really hae liked to take peek at the connection pool your
>    are using to figure out what happens here. Where does this JdbcUtil
>    you are using coe from. Equinox?
>
> Bernt
>
>
>   
>>>>>>>>>>>>> Xanana Gusmao wrote (2006-12-12 04:00:58):
>>>>>>>>>>>>>                           
>> On reading the javadoc, it is mentioned that:
>>
>> A ResultSet object is automatically closed by the Statement object that
>> generated it when that Statement object is closed, re-executed, or is used to
>> retrieve the next result from a sequence of multiple results.
>>
>> Thus I don't close the ResultSet anymore.
>>
>> To solve the problem, Connection needs to be closed prior to Statements.
>>
>> e.g. This does not throw any SQLException
>>
>> finally
>> {
>>     try
>>     {
>>         conn.close(); 
>>         statement.close();
>>     }
>>     catch( SQLException sqle )
>>     {
>>        ...
>>     }
>> }
>>
>>
>>
>>
>>     
>
>   

Mime
View raw message