Home > Archive > PostgreSQL JDBC > April 2005 > java connection closing itself









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 java connection closing itself
Clifton Zama

2005-04-12, 3:24 am

Hi

What would cause a connection to automatically close within a java program.It
gets to a point where I have an inner loop that calls a recursive method that
creates resultsets.But I am closing all my result sets, so I do not know why
the connection simply closes itself.Please help.

Clifton Zama

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Guillaume Cottenceau

2005-04-12, 7:24 am

Clifton Zama <csz 'at' jhb.ucs.co.za> writes:

> Hi
>
> What would cause a connection to automatically close within a
> java program.It gets to a point where I have an inner loop that
> calls a recursive method that creates resultsets.But I am
> closing all my result sets, so I do not know why the connection
> simply closes itself.Please help.


There is a "bug" in which the DB driver tells you that the
connection is closed, although it isn't really closed, in
situations where the data is not available anymore.

Such a situation occurs when a ResultSet has been closed but you
are still trying to extract data from it. A ResultSet can be
closed by calling its close method, but also implicitely when the
Statement object that generated it is closed, re-executed, or is
used to retrieve the next result from a sequence of multiple
results.

http://java.sun.com/j2se/1.4.2/docs...tSet.html#close()

To make it short: if you're nesting multiple #executeQuery() on a
single Statement object, you're going to have this problem if
your loop goes down the nesting and does subsequent accesses to
the ResultSet.

--
Guillaume Cottenceau

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com