X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0815EDB1EB for ; Fri, 28 Oct 2005 07:47:25 -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 33167-09 for ; Fri, 28 Oct 2005 10:47:21 +0000 (GMT) Received: from mail-relay.rwa-net.co.uk (mail-relay.rwa-net.co.uk [62.189.139.18]) by svr1.postgresql.org (Postfix) with ESMTP id A97C9DB090 for ; Fri, 28 Oct 2005 07:47:21 -0300 (ADT) Received: from saturn.rwa-net.co.uk (saturn.rwa-net.co.uk [62.189.139.33]) by mail-relay.rwa-net.co.uk (8.11.6/8.11.6) with ESMTP id j9SAlMA08162 for ; Fri, 28 Oct 2005 11:47:22 +0100 Received: from [62.189.139.142] by saturn.cvw.org.uk (NTMail 7.00.0018/NT4698.00.83343e8d) with ESMTP id nbnodaaa for pgsql-jdbc@postgresql.org; Fri, 28 Oct 2005 11:47:11 +0100 Message-ID: <436201A8.9080800@rwa-net.co.uk> Date: Fri, 28 Oct 2005 11:47:04 +0100 From: Matthew Lunnon User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?UTF-8?B?QXlkxLFuIFRvcHJhaw==?= Cc: pgsql-jdbc@postgresql.org Subject: Re: Problems with ResultSet References: <4361FAE1.4010806@intengo.com> In-Reply-To: <4361FAE1.4010806@intengo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-AuthenticatedSender: mlunnon@rwa-net.co.uk X-Info: UNKNOWN-USER X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200510/144 X-Sequence-Number: 14075 Its the stmnt.close() that is the problem. This will close the ResultSet as well. You will need to close this statement at some point but you must use the ResultSet first. Come possiblility is to return the statement and not the result set. You can then call getResultSet() on the statement and close the statement when you are finished. You should also make sure that you tidy up the connection. Cheers Matthew. Aydın Toprak wrote: > Hiii, > > > I have just stuck with a little point of my code which generates "This > ResultSet is closed." exception .... > > here is my stack trace ... > org.postgresql.util.PSQLException: This ResultSet is closed. > org.postgresql.jdbc2.AbstractJdbc2ResultSet.checkClosed(AbstractJdbc2ResultSet.java:2444) > > org.postgresql.jdbc2.AbstractJdbc2ResultSet.next(AbstractJdbc2ResultSet.java:1810) > > org.apache.jsp.event.Proposal.frameBuyer_jsp._jspService(org.apache.jsp.event.Proposal.frameBuyer_jsp:61) > > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) > javax.servlet.http.HttpServlet.service(HttpServlet.java:802) ... and > continues... > > > > I want to return ResultSet from static method (I have never did > before, I guess I can ..??.) ... I get resultset from my jsp page and > want to display it ... > so ı wrote this database access staff into another class file to > sperate them ... anyway.. > > > try > { > stmnt = con.prepareStatement(query); > stmnt.setInt(1, event_id); > ps = stmnt.executeQuery(); > stmnt.close(); > connMgr.freeConnection("mypool", con); > if(ps.next()) > out.append("This is your element :"+ps.getInt("event_id")); > } > > this is the part of the code wich generated that exception... > > as a result of my obeservations and try... I can directly point that > the porblem comes from this > if(ps.next()) > out.append("This is your element :"+ps.getInt("event_id")); > > part of the code... > > > but I dont understand why?.... the query is file, P.statement and > connection is exist ... and also there is an integer coloumn > "event_id" in table... > > is it about the static method or what..? .. > > Thanks.. > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > > _____________________________________________________________________ > This e-mail has been scanned for viruses by MCI's Internet Managed > Scanning Services - powered by MessageLabs. For further information > visit http://www.mci.com