Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 3ED0C9FB228 for ; Mon, 15 Jan 2007 09:43:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 64060-05 for ; Mon, 15 Jan 2007 09:42:33 -0400 (AST) X-Greylist: delayed 00:32:53.764238 by SQLgrey-1.7.4 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id C95ED9FB213 for ; Mon, 15 Jan 2007 09:42:33 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from post.umb.no (bukk.ans.umb.no [128.39.176.2]) by svr4.postgresql.org (Postfix) with ESMTP id 013A15AFC7D for ; Mon, 15 Jan 2007 13:09:39 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by umb.no (Postfix) with ESMTP id 4CFAEEB15A; Mon, 15 Jan 2007 14:09:36 +0100 (CET) Received: from post.umb.no ([127.0.0.1]) by localhost (post [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 22136-04; Mon, 15 Jan 2007 14:09:36 +0100 (CET) Received: from [128.39.236.206] (imt-havatv.ans.umb.no [128.39.236.206]) by post.umb.no (Postfix) with ESMTP id DEEE1EB151; Mon, 15 Jan 2007 14:09:35 +0100 (CET) Message-ID: <45AB7D70.5050702@umb.no> Date: Mon, 15 Jan 2007 14:11:12 +0100 From: Havard Tveite User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: "nested transaction" - encosing statement gets closed when the enclosed statement is closed Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new-20030616-p9 (Debian) at post.umb.no X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.136 tagged_above=0 required=5 tests=BAYES_50, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200701/97 X-Sequence-Number: 16462 I have experienced problems using the JDBC type 2 and type 3 drivers for 8.1 (postgresql-8.1-408.jdbc3.jar, postgresql-8.1-408.jdbc2.jar) against PostgreSQL 8.1.5. I am running through the ResultSet of a select query that involves a join, and for each result I do a lookup on one of the tables in the join. Statement stmt = conn.createStatement(); Statement stmtchk = conn.createStatement(); .... ResultSet rs = stmt.executeQuery(searchquery); .... while (rs.next()) { ..... For the lookup, I do ResultSet rsch = stmtchk.executeQuery(checkquery); while (rsch.next()) { maxrefid = rsch.getInt("max"); } rsch.close(); stmtchk.close(); // leads to the closing of stmt!!! ... } // while For some reason, the ResultSet that I am looping through is closed by the lookup, and I receive the following exception: "SQL Exception (working on resultset)! (selecttempmaps): org.postgresql.util.PSQLException: This statement has been closed." In PostgreSQL 7.4.1 I did not experience this behaviour. As you can see, I am using a new statement for the lookup. I have also tried to create a new connection for the lookup, but the problem persists. If I comment out stmtchk.close(), the application runs as it did in 7.4.1. Is this expected behaviour? -- Håvard Tveite Department of Mathematical Sciences and Technology, UMB Drøbakveien 14, POBox 5003, N-1432 Ås, NORWAY Phone: +47 64965483 Fax: +47 64965401 http://www.umb.no/imt