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 203ED5289E for ; Tue, 7 Jun 2005 17:05:37 -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 52547-09 for ; Tue, 7 Jun 2005 20:05:32 +0000 (GMT) Received: from WM14.inbox.com (wm14.inbox.com [208.50.6.14]) by svr1.postgresql.org (Postfix) with SMTP id 0EECD52899 for ; Tue, 7 Jun 2005 17:05:31 -0300 (ADT) Received: from inbox.com (127.0.0.1:25) by inbox.com with [InBox.Com ESMTP Server] id <506070021074.WM14> for from ; Tue, 7 Jun 2005 12:05:30 PM -0800 Mime-Version: 1.0 Date: Tue, 7 Jun 2005 12:05:28 -0800 Message-ID: <970549EC73A.000005A3sathyajith@inbox.com> From: Sathyajith G Subject: Re: exception while upgrading driver To: Kris Jurka Cc: pgsql-jdbc@postgresql.org In-Reply-To: References: <9648e4d3482.000004d1sathyajith@inbox.com> X-Mailer: IBISIT WebMail Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/25 X-Sequence-Number: 12987 >> > > On Tue, 7 Jun 2005, Sathyajith G wrote: > > > i have the following code running without any errors with postgres > 7.4.2. > > driver. > > > > String qry=3D=22select ...; > > > > try=7B > > ResultSet rs=3DData.getResultSet(qry); > > while(rs.next()) > > > > I changed the driver to postgres 8.0.1. Strangely now, the above code > gives > > the exception =22The resultset is closed=22. Please help. > > > > I suspect your Data.getResultSet() method looks something like this: > > > Statement stmt =3D conn.createStatement(); > ResultSet rs =3D stmt.executeQuery(sql); > stmt.close(); > return rs; > > This is not a legal thing to do, closing the Statement also closes the > ResultSet that was created by it. The 7.4 driver did not correctly check > this, but the 8.0 version does. You most postpone the Statement close > until you are done with the ResultSet. > > Kris Jurka > ------------------------------------------------------------------- i am not closing the statement anywhere. this is how Data.getResultSet() looks like: public static ResultSet getResultSet(String sql) =7B ResultSet rs; try=7B rs=3Dstmt.executeQuery(sql); =7Dcatch(Exception e) =7BSystem.err.println(=22error=22); rs=3Dnull; =7D return rs; =7D Sathyajith Gopi=