pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Aydın Toprak <aydin.toprak@intengo.com>
To: pgsql-jdbc@postgresql.org
Subject: Problems with ResultSet
Date: Fri, 28 Oct 2005 13:18:09 +0300
Message-ID: <4361FAE1.4010806@intengo.com> (raw)

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..



view thread (7+ messages)  latest in thread

Message-ID: <4361FAE1.4010806@intengo.com>
Permalink:  ../4361FAE1.4010806@intengo.com/
Also on:    postgresql.org/message-id/4361FAE1.4010806@intengo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: aydin.toprak@intengo.com
  Subject: Re: Problems with ResultSet
  In-Reply-To: <4361FAE1.4010806@intengo.com>
  References: <4361FAE1.4010806@intengo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox