X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 89DA753415 for ; Tue, 12 Apr 2005 07:54:29 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34345-09 for ; Tue, 12 Apr 2005 10:54:27 +0000 (GMT) Received: from mnc.ch (www.mnc.ch [212.23.250.43]) by svr1.postgresql.org (Postfix) with ESMTP id 0172153324 for ; Tue, 12 Apr 2005 07:54:25 -0300 (ADT) Received: (qmail 18188 invoked from network); 12 Apr 2005 12:54:27 +0200 Received: from 62-2-77-204.business.cablecom.ch (HELO meuh.mnc.ch) (62.2.77.204) by www.mnc.ch with SMTP; 12 Apr 2005 12:54:27 +0200 Received: by meuh.mnc.ch (Postfix, from userid 1000) id 9212E23EE66; Tue, 12 Apr 2005 12:54:23 +0200 (CEST) To: Clifton Zama Cc: pgsql-jdbc@postgresql.org Subject: Re: java connection closing itself References: <200504131026.04762.csz@jhb.ucs.co.za> From: Guillaume Cottenceau Date: 12 Apr 2005 12:54:23 +0200 In-Reply-To: <200504131026.04762.csz@jhb.ucs.co.za> Message-ID: <87aco4b6zk.fsf@meuh.mnc.ch> Lines: 30 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.052 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200504/71 X-Sequence-Number: 12678 Clifton Zama 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/api/java/sql/ResultSet.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