|
Home > Archive > PostgreSQL JDBC > April 2005 > Impact of open ResultSets and PreparedStatements ?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Impact of open ResultSets and PreparedStatements ?
|
|
| Antony Paul 2005-04-26, 9:23 am |
| 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/
---------------------------(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
| |
| Kris Jurka 2005-04-29, 3:25 am |
|
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
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql
.org
| |
| Antony Paul 2005-04-29, 7:25 am |
| On 4/29/05, Kris Jurka <books@ejurka.com> wrote:
>
>
> On Tue, 26 Apr 2005, Antony Paul wrote:
>
>
> 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/
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq
| |
| Kris Jurka 2005-04-29, 7:25 am |
|
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
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
|
|
|
|
|