Re: Pooling Prepared Statements

From: João Paulo Caldas Ribeiro <jp(at)mobicomp(dot)com>
To: Rainer Klute <rainer(dot)klute(at)epost(dot)de>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Pooling Prepared Statements
Date: 2002-08-30 15:30:44
Message-ID: 3D6F8FA4.50808@mobicomp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)rainer-klute(dot)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(at)postgresql(dot)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
----------------------------------------------------------------------------

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message João Paulo Caldas Ribeiro 2002-08-30 15:35:24 Re: Connections/Statements/ResultSets (Was: Re: Pooling
Previous Message Thomas O'Dowd 2002-08-30 15:13:43 Re: Connections/Statements/ResultSets (Was: Re: Pooling