pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: Karen Goh <karenworld@yahoo.com>
Cc: Mikko Tiihonen <mikko.tiihonen@nitor.com>
Cc: pgsql-jdbc@lists.postgresql.org
Subject: Re: how to resolve org.postgresql.util.PSQLException: ResultSet not positioned properly, perhaps you need to call next.
Date: Wed, 4 Sep 2019 23:35:25 -0700
Message-ID: <B73E9B66-1450-45B0-8B63-15882EDF071D@gmail.com> (raw)
In-Reply-To: <1920437895.1671102.1567652395252@mail.yahoo.com>
References: <932079842.712590.1567405714491@mail.yahoo.com>
	<58285538-686D-45F6-B5A5-883DBE7D0C10@gmail.com>
	<1422030722.958511.1567487705474@mail.yahoo.com>
	<1ACDE5B3-3F0E-4BF0-8C37-DAD09F35F30C@gmail.com>
	<860006402.1322813.1567568281784@mail.yahoo.com>
	<B3FFC2E6-0BBC-41F5-863B-396417CB0FDF@gmail.com>
	<1829430979.1362196.1567576711470@mail.yahoo.com>
	<HE1PR07MB33551E363E3A17192C5A1E2488B80@HE1PR07MB3355.eurprd07.prod.outlook.com>
	<1920437895.1671102.1567652395252@mail.yahoo.com>

After you address your Tomcat issue I would like to see the entire method named in the stack

> On Sep 4, 2019, at 7:59 PM, Karen Goh <karenworld@yahoo.com> wrote:
> 
> 
> I have posted the full code already in my first email. What other parts do you want to see. I am really puzzled about your question also.....
> 
> On Wednesday, September 4, 2019, 4:02:21 PM GMT+8, Mikko Tiihonen <mikko.tiihonen@nitor.com> wrote:
> 
> 
> Hi,
> 
> Rob is not being impolite. Asking to verify if it is your code is the most polite thing he can do since you have not posted the full code you are running.
> If the Controller would have been a 3rd party library code then Rob would have had to pivot to searching what is wrong there.
> In this case he made an educated guess and tried to propose further actions based on it.
> 
> It would really help if you posted the full contents of the method that obtains the Result set and handles it. We are really searching for the rs.next() call, as that is what the error message says is missing.
> The two likely scenarios are: either it is missing from the code completely or you fail to call it again in a loop after each row.
> 
> -Mikko
> 
> From: Karen Goh <karenworld@yahoo.com>
> Sent: 04 September 2019 08:58
> To: Rob Sargent <robjsargent@gmail.com>
> Cc: pgsql-jdbc@lists.postgresql.org <pgsql-jdbc@lists.postgresql.org>
> Subject: Re: how to resolve org.postgresql.util.PSQLException: ResultSet not positioned properly, perhaps you need to call next.
>  
> Hi Rob,
> 
> I find the way you asked me if it is my code very strange and why would you say it is not my code, and I have been fighting every minute to resolve this and my head is pain with all these error !
> 
> If you can't help me, the least you can is to own up you don't have the answer or refrain from saying something that is not RIGHT.
> 
> Thanks 
> On Wednesday, September 4, 2019, 1:13:15 PM GMT+8, Rob Sargent <robjsargent@gmail.com> wrote:
> 
> 
> 
> 
> > On Sep 3, 2019, at 9:38 PM, Karen Goh <karenworld@yahoo.com> wrote:
> > 
> > Sure.
> > I tried various ways to see if there is any mistakes. Still, I get the same old error :(
> > 
> > Very difficult to type in Yahoo mail now...so I am continuing here (after you read the last sentence of the mail)
> > 
> > So, even if I remove the System.out.print...it still gives me the error...
> > 
> > Could it be Tomcat problem ? because I remove the page forwarded lines all altogether and it gave me the same old error as per not positioned properly, blah ...
> > 
> > org.postgresql.util.PSQLException: ResultSet not positioned properly, perhaps you need to call next.
> > at org.postgresql.jdbc.PgResultSet.checkResultSet(PgResultSet.java:2772)
> > at org.postgresql.jdbc.PgResultSet.getInt(PgResultSet.java:2052)
> > at org.postgresql.jdbc.PgResultSet.getInt(PgResultSet.java:2485)
> > at Controller.searchController.doPost(searchController.java:117)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
> > at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
> > at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> > at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
> > at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> > at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> > at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71)
> > at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> > at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> > at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
> > at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
> > at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526)
> > at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
> > at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
> > at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678)
> > at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
> > at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
> > at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
> > at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
> > at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860)
> > at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587)
> > at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
> > at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> > at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> > at java.lang.Thread.run(Thread.java:748)
> > 
> > And below the line that is giving problem :
> > subjList.add(rs.getString("subject_name"));
> > newSub.addAll(subjList);
> > 
> > System.out.println( "tutor ID=" + rs.getInt("tutor_id") + "zipcode =" + rs.getString("zipcode") +
> > "subjectName=" + rs.getString("subject_name") + "tutorContact=" +
> > rs.getString("tutor_contact_no")); 
> > }}
> > I now inserted it before the close bracket of resultset.
> > 
> > It points to System.out.print
> 
> > 
> Is "Controller.searchController.doPost(searchController.java:117)” your code?  Do you in fact call rs.next() appropriately?
> Also unless there’s a subjList = new List<> (or subjList.clear()) somewhere nearby you may be adding the contents of subjList more than once.  There’s not enough of your code here to tell for sure exactly what’s going on.
> 
> 
> 

view thread (21+ messages)  latest in thread

Message-ID: <B73E9B66-1450-45B0-8B63-15882EDF071D@gmail.com>
Permalink:  ../B73E9B66-1450-45B0-8B63-15882EDF071D@gmail.com/
Also on:    postgresql.org/message-id/B73E9B66-1450-45B0-8B63-15882EDF071D@gmail.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: robjsargent@gmail.com, karenworld@yahoo.com, mikko.tiihonen@nitor.com
  Subject: Re: how to resolve org.postgresql.util.PSQLException: ResultSet not positioned properly, perhaps you need to call next.
  In-Reply-To: <B73E9B66-1450-45B0-8B63-15882EDF071D@gmail.com>
  References: <932079842.712590.1567405714491@mail.yahoo.com> <58285538-686D-45F6-B5A5-883DBE7D0C10@gmail.com> <1422030722.958511.1567487705474@mail.yahoo.com> <1ACDE5B3-3F0E-4BF0-8C37-DAD09F35F30C@gmail.com> <860006402.1322813.1567568281784@mail.yahoo.com> <B3FFC2E6-0BBC-41F5-863B-396417CB0FDF@gmail.com> <1829430979.1362196.1567576711470@mail.yahoo.com> <HE1PR07MB33551E363E3A17192C5A1E2488B80@HE1PR07MB3355.eurprd07.prod.outlook.com> <1920437895.1671102.1567652395252@mail.yahoo.com> <B73E9B66-1450-45B0-8B63-15882EDF071D@gmail.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