pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Impact of open ResultSets and PreparedStatements ?
4+ messages / 2 participants
[nested] [flat]

* Impact of open ResultSets and PreparedStatements ?
@ 2005-04-26 13:24 Antony Paul <antonypaul24@gmail.com>
  2005-04-29 08:04 ` Re: Impact of open ResultSets and PreparedStatements ? Kris Jurka <books@ejurka.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Antony Paul @ 2005-04-26 13:24 UTC (permalink / raw)
  To: pgsql-jdbc

Hi all,
    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 ?.
-- 
rgds
Antony Paul
http://www.geocities.com/antonypaul24/



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Impact of open ResultSets and PreparedStatements ?
  2005-04-26 13:24 Impact of open ResultSets and PreparedStatements ? Antony Paul <antonypaul24@gmail.com>
@ 2005-04-29 08:04 ` Kris Jurka <books@ejurka.com>
  2005-04-29 09:46   ` Re: Impact of open ResultSets and PreparedStatements ? Antony Paul <antonypaul24@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Kris Jurka @ 2005-04-29 08:04 UTC (permalink / raw)
  To: Antony Paul <antonypaul24@gmail.com>; +Cc: pgsql-jdbc



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




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Impact of open ResultSets and PreparedStatements ?
  2005-04-26 13:24 Impact of open ResultSets and PreparedStatements ? Antony Paul <antonypaul24@gmail.com>
  2005-04-29 08:04 ` Re: Impact of open ResultSets and PreparedStatements ? Kris Jurka <books@ejurka.com>
@ 2005-04-29 09:46   ` Antony Paul <antonypaul24@gmail.com>
  2005-04-29 09:58     ` Re: Impact of open ResultSets and PreparedStatements ? Kris Jurka <books@ejurka.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Antony Paul @ 2005-04-29 09:46 UTC (permalink / raw)
  To: pgsql-jdbc; Kris Jurka <books@ejurka.com>

On 4/29/05, Kris Jurka <books@ejurka.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/



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Impact of open ResultSets and PreparedStatements ?
  2005-04-26 13:24 Impact of open ResultSets and PreparedStatements ? Antony Paul <antonypaul24@gmail.com>
  2005-04-29 08:04 ` Re: Impact of open ResultSets and PreparedStatements ? Kris Jurka <books@ejurka.com>
  2005-04-29 09:46   ` Re: Impact of open ResultSets and PreparedStatements ? Antony Paul <antonypaul24@gmail.com>
@ 2005-04-29 09:58     ` Kris Jurka <books@ejurka.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Kris Jurka @ 2005-04-29 09:58 UTC (permalink / raw)
  To: Antony Paul <antonypaul24@gmail.com>; +Cc: pgsql-jdbc



On Fri, 29 Apr 2005, Antony Paul wrote:

> 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 ?.
> 

In 7.3 all ResultSets fetch the entire result immediately leaving 
nothing on the server.

Kris Jurka




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2005-04-29 09:58 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-04-26 13:24 Impact of open ResultSets and PreparedStatements ? Antony Paul <antonypaul24@gmail.com>
2005-04-29 08:04 ` Kris Jurka <books@ejurka.com>
2005-04-29 09:46   ` Antony Paul <antonypaul24@gmail.com>
2005-04-29 09:58     ` Kris Jurka <books@ejurka.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox