Re: Impact of open ResultSets and PreparedStatements ?

From: Antony Paul <antonypaul24(at)gmail(dot)com>
To: PostgreSQL JDBC <pgsql-jdbc(at)postgresql(dot)org>, Kris Jurka <books(at)ejurka(dot)com>
Subject: Re: Impact of open ResultSets and PreparedStatements ?
Date: 2005-04-29 09:46:32
Message-ID: 2989532e050429024652aca0be@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On 4/29/05, Kris Jurka <books(at)ejurka(dot)com> wrote:
>
>
> On Tue, 26 Apr 2005, Antony Paul wrote:
>
> > What will happen if I leave ResultSet and PreparedStatement not
> > closed and I use a connection pool which is not closing the ResultSet
> > and PreparedStatement. Will it cause resource leak in the server ?.
>
> It depends there are two types of PreparedStatements and two types of
> ResultSets each one has a version that takes no permanent server resources
> and a version that does. A PreparedStatement may keep a permanent
> prepared plan on the server and a ResultSet may be backed by a cursor
> which also has server state. Its possible you can get away with it, but
> it's best to close everything.
>
> Kris Jurka
>
>

Thanks for the reply.
I am using PostgreSQL 7.3 (server and JDBC driver) and no stored
procedures are used but uses the built in functions. I know that in
this version PreparedStatements are not kept in the server. What about
the ResultSet ?. Does all the data is transferred to application right
after the query is executed or only a predefined no of records are
returned while going through the rs.next() call ?.

--
rgds
Antony Paul
http://www.geocities.com/antonypaul24/

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2005-04-29 09:51:51 Re: Problems storing timestamps with calendars
Previous Message Kris Jurka 2005-04-29 08:44:35 Re: CallableStatement problem...?