Re: Problems with ResultSet

Поиск
Список
Период
Сортировка
От David Goodenough
Тема Re: Problems with ResultSet
Дата
Msg-id 200510281132.29818.david.goodenough@btconnect.com
обсуждение исходный текст
Ответ на Problems with ResultSet  (Aydın Toprak <aydin.toprak@intengo.com>)
Ответы Re: Problems with ResultSet  (João Paulo Ribeiro <jp@mobicomp.com>)
Список pgsql-jdbc
Closing the statement closes everything that came from it, i.e. the ResultSet.
So you need to delay closing the statement until after you have finished with
the ResultSet.

David

On Friday 28 October 2005 11:18, 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(AbstractJdbc2Result
>Set.java:2444)
>
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.next(AbstractJdbc2ResultSet.jav
>a:1810)
>
> org.apache.jsp.event.Proposal.frameBuyer_jsp._jspService(org.apache.jsp.eve
>nt.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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Aydın Toprak
Дата:
Сообщение: Problems with ResultSet
Следующее
От: Matthew Lunnon
Дата:
Сообщение: Re: Problems with ResultSet