Re: Pooling Prepared Statements - Mailing list pgsql-jdbc

From João Paulo Caldas Ribeiro
Subject Re: Pooling Prepared Statements
Date
Msg-id 3D6F8FA4.50808@mobicomp.com
Whole thread Raw
In response to Re: Pooling Prepared Statements  (Rainer Klute <rainer.klute@epost.de>)
List pgsql-jdbc
Hi!

The rule is:
Close any object that refer or use something remote (connections,
statements, resultsets) as soon as possible. Because this kind of object
are not automatically garbage collected and will remaind until you
explecitly close them.

The exception is:
if this kind of object are pooled then never close them explicitly just
release them back to the pool ( sometimes the method to release the
object to the pool is called ".close()" but it dont explicitly close the
object. It still  juts give it back to the pool). The pool is reponsable
to decide if it need more objects and create them or have to much (or to
old objects?) and decide to destroy/close them.

Regards.
JP



Rainer Klute wrote:

>>You are right. It's  1 statement -> 1 resultset at a time.
>>
>>As Dave said: "A ResultSet object is automatically closed when the
>>Statement object
>>that generated it is closed, re-executed, or used to retrieve the next
>>result from a sequence of multiple results. "
>>
>>My mistake.
>>
>>
>
>It is still a good idea to close result sets after use. If you
>rely on automatically closing them you might have some wasted
>resources lying around because you might execute a statement
>and never reuse it.
>
>It is also a good idea to explicitly close statements and
>connections.
>
>Best regards
>Rainer Klute
>
>                           Rainer Klute IT-Consulting GmbH
>  Dipl.-Inform.
>  Rainer Klute             E-Mail:  klute@rainer-klute.de
>  Körner Grund 24          Telefon: +49 172 2324824
>D-44143 Dortmund           Telefax: +49 231 5349423
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 3: if posting/reading through Usenet, please send an appropriate
>subscribe-nomail command to majordomo@postgresql.org so that your
>message can get through to the mailing list cleanly
>
>
>
>


--
----------------------------------------------------------------------------
MobiComp - Mobile Computing & Wireless Solutions
phone: +351 253 305 250     fax: +351 253 305 251
web: http://www.mobicomp.com
----------------------------------------------------------------------------





pgsql-jdbc by date:

Previous
From: Thomas O'Dowd
Date:
Subject: Re: Connections/Statements/ResultSets (Was: Re: Pooling
Next
From: João Paulo Caldas Ribeiro
Date:
Subject: Re: Connections/Statements/ResultSets (Was: Re: Pooling