Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i5i0K-0000fj-6x for pgsql-jdbc@arkaria.postgresql.org; Thu, 05 Sep 2019 03:00:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i5i0J-0002KI-05 for pgsql-jdbc@arkaria.postgresql.org; Thu, 05 Sep 2019 03:00:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i5i0I-0002Fz-IJ for pgsql-jdbc@lists.postgresql.org; Thu, 05 Sep 2019 03:00:10 +0000 Received: from sonic313-15.consmr.mail.bf2.yahoo.com ([74.6.133.125]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i5i0A-0003Xt-Vk for pgsql-jdbc@lists.postgresql.org; Thu, 05 Sep 2019 03:00:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1567652400; bh=kHq++nRXaBtfpSlD8pynE3lON8ltmlYI4fj2NfALXWw=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From:Subject; b=LT7qUeWpFWWHeQMN5ulcTYODxcHK05nzCz02RCJGhdMc2J1MfD3qwrpT0pQKHk4eNqe8i6g7HK1HtO0pm6GkCo5WKYDOYH7foBFprXJcFH4Jutqp7f3cC6dZV+GEZq35Lco16GpLtgf17n5tmjRLLM+8B0uueZE4meQqtQGEqDq4ySxv6OeGCpqVedS9/s8Lan2zpoDme3iqgLAF8nXD4PIL00gV+FIE1UlyDzKYYshSIiz3ok4pe2Q1SqJ4AB3M3Rw5iECRO6X8oOF8Rxhek7c8LEUOgVjWhD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VD5kmviMuFFR2HjMWaG0Q4DIGhgjMm3RmRVmeNiE8 tRohjjGgBKIIWIwXsX_3GwvWKMN1p9Rk5.WkQ.c8b.O_m9y00F2nrJSUidwJo1XLj7.jeOkkxl5P oCgSwMzSWUOg.hLQzvePO.PFqsV4bMOvW8_z2_KvbFZfojnLhQKDXTnR.qSpetRCo6iGcW3tnlkM aeOSx9f6n3oLqLkUIzMXprTm4LXaAFaS4ciMr2uOv2qk5xxSkqvn4w0.juO_QSuIt8mMkcrD4Ofh XNIBw8tMDJtEiV9vFskOBkecom8WHaouj8Jl9ViOVwnVQI19KJuy_kFZMgHGBtZMEC0mW.34- Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.bf2.yahoo.com with HTTP; Thu, 5 Sep 2019 03:00:00 +0000 Date: Thu, 5 Sep 2019 02:59:55 +0000 (UTC) From: Karen Goh To: Rob Sargent , Mikko Tiihonen Cc: pgsql-jdbc@lists.postgresql.org Message-ID: <1920437895.1671102.1567652395252@mail.yahoo.com> In-Reply-To: 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> <1829430979.1362196.1567576711470@mail.yahoo.com> Subject: Re: how to resolve org.postgresql.util.PSQLException: ResultSet not positioned properly, perhaps you need to call next. MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1671101_805143146.1567652395250" Content-Length: 16887 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_1671101_805143146.1567652395250 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =20 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 wrote: =20 =20 #yiv9100579513 P {margin-top:0;margin-bottom:0;}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 runn= ing. If the Controller would have been a 3rd party library code then Rob would h= ave had to pivot to searching what is wrong there.In this case he made an e= ducated guess and tried to propose further actions based on it. It would really help if you posted the full contents of the method that obt= ains 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 s= cenarios 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 Sent: 04 September 2019 08:58 To: Rob Sargent Cc: pgsql-jdbc@lists.postgresql.org Subject: Re: how to resolve org.postgresql.util.PSQLException: ResultSet no= t positioned properly, perhaps you need to call next.=C2=A0Hi 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 th= is 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 ans= wer or refrain from saying something that is not RIGHT. Thanks=20 On Wednesday, September 4, 2019, 1:13:15 PM GMT+8, Rob Sargent wrote: > On Sep 3, 2019, at 9:38 PM, Karen Goh wrote: >=20 > Sure. > I tried various ways to see if there is any mistakes. Still, I get the sa= me old error :( >=20 > Very difficult to type in Yahoo mail now...so I am continuing here (after= you read the last sentence of the mail) >=20 > So, even if I remove the System.out.print...it still gives me the error..= . >=20 > Could it be Tomcat problem ? because I remove the page forwarded lines al= l altogether and it gave me the same old error as per not positioned proper= ly, blah ... >=20 > org.postgresql.util.PSQLException: ResultSet not positioned properly, per= haps 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(Appli= cationFilterChain.java:231) > at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi= lterChain.java:166) > at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) > at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli= cationFilterChain.java:193) > at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi= lterChain.java:166) > at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletF= ilter.java:71) > at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli= cationFilterChain.java:193) > at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi= lterChain.java:166) > at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa= lve.java:202) > at org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa= lve.java:96) > at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticat= orBase.java:526) > at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja= va:139) > at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.ja= va:92) > at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAcces= sLogValve.java:678) > at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValv= e.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(AbstractProcessorLigh= t.java:66) > at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractP= rotocol.java:860) > at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoi= nt.java:1587) > at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase= .java:49) > at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.j= ava:1149) > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.= java:624) > at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThr= ead.java:61) > at java.lang.Thread.run(Thread.java:748) >=20 > And below the line that is giving problem : > subjList.add(rs.getString("subject_name")); > newSub.addAll(subjList); >=20 > System.out.println( "tutor ID=3D" + rs.getInt("tutor_id") + "zipcode =3D"= + rs.getString("zipcode") + > "subjectName=3D" + rs.getString("subject_name") + "tutorContact=3D" + > rs.getString("tutor_contact_no"));=20 > }} > I now inserted it before the close bracket of resultset. >=20 > It points to System.out.print >=20 Is "Controller.searchController.doPost(searchController.java:117)=E2=80=9D = your code?=C2=A0 Do you in fact call rs.next() appropriately? Also unless there=E2=80=99s a subjList =3D new List<> (or subjList.clear())= somewhere nearby you may be adding the contents of subjList more than once= .=C2=A0 There=E2=80=99s not enough of your code here to tell for sure exact= ly what=E2=80=99s going on. =20 ------=_Part_1671101_805143146.1567652395250 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

I have posted the full code already in my first em= ail. 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> w= rote:

<= div>
Hi,

Rob is not be= ing 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 educ= ated 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 comp= letely or you fail to call it again in a loop after each row.

-Mikko


From: Karen Goh <karenworld@yahoo.com&= gt;
Sent: 04 September 2019 08:58
To: Rob Sargent <robjsargent@gmail.com>
Cc: pgsql-jdbc@lists.postgresql.org <pgsql-jdbc@lists.postgresql.or= g>
Subject: Re: how to resolve org.postgresql.u= til.PSQLException: ResultSet not positioned properly, perhaps you need to c= all next.
 
Hi Rob,
=
I find the way you asked me if it is my code very strang= e and why would you say it is not my code, and I have been fighting every m= inute 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 n= ot 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.
&g= t; I tried various ways to see if there is any mistakes. Still, I get the s= ame old error :(
>
> Very diffic= ult 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...<= br clear=3D"none">>
> Could it be Tomcat problem ?= because I remove the page forwarded lines all altogether and it gave me th= e same old error as per not positioned properly, blah ...
>
> org.postgresql.util.PSQLException: ResultSet = not positioned properly, perhaps you need to call next.
&= gt; at org.postgresql.jdbc.PgResultSet.checkResultSet(PgResultSet.java:2772= )
> at org.postgresql.jdbc.PgResultSet.getInt(PgResult= Set.java:2052)
> at org.postgresql.jdbc.PgResultSet.ge= tInt(PgResultSet.java:2485)
> at Controller.searchCont= roller.doPost(searchController.java:117)
> at javax.se= rvlet.http.HttpServlet.service(HttpServlet.java:660)
>= at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
> at org.apache.catalina.core.ApplicationFilterChain.internalD= oFilter(ApplicationFilterChain.java:231)
> at org.apac= he.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.jav= a:166)
> at org.apache.tomcat.websocket.server.WsFilte= r.doFilter(WsFilter.java:53)
> at org.apache.catalina.= core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:19= 3)
> at org.apache.catalina.core.ApplicationFilterChai= n.doFilter(ApplicationFilterChain.java:166)
> at org.a= pache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java= :71)
> at org.apache.catalina.core.ApplicationFilterCh= ain.internalDoFilter(ApplicationFilterChain.java:193)
>= ; at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi= lterChain.java:166)
> at org.apache.catalina.core.Stan= dardWrapperValve.invoke(StandardWrapperValve.java:202)
&g= t; at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV= alve.java:96)
> at org.apache.catalina.authenticator.A= uthenticatorBase.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.cata= lina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678)<= br clear=3D"none">> at org.apache.catalina.core.StandardEngineValve.invo= ke(StandardEngineValve.java:74)
> at org.apache.catali= na.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
> at org.apache.coyote.http11.Http11Processor.service(Http11Processor.= java:408)
> at org.apache.coyote.AbstractProcessorLigh= t.process(AbstractProcessorLight.java:66)
> at org.apa= che.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java= :860)
> at org.apache.tomcat.util.net.NioEndpoint$Sock= etProcessor.doRun(NioEndpoint.java:1587)
> at org.apac= he.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(Th= readPoolExecutor.java:1149)
> at java.util.concurrent.= ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(Ta= skThread.java:61)
> at java.lang.Thread.run(Thread.jav= a:748)
>
> And below the line th= at is giving problem :
> subjList.add(rs.getString("su= bject_name"));
> newSub.addAll(subjList);
>
> System.out.println( "tutor ID=3D" + rs.g= etInt("tutor_id") + "zipcode =3D" + rs.getString("zipcode") +
> "subjectName=3D" + rs.getString("subject_name") + "tutorContact= =3D" +
> rs.getString("tutor_contact_no"));
> }}
> I now inserted it before the close= bracket of resultset.
>
> It po= ints to System.out.print

>
Is= "Controller.searchController.doPost(searchController.java:117)=E2=80=9D yo= ur code?  Do you in fact call rs.next() appropriately?
Also unless there=E2=80=99s a subjList =3D new List<> (or subjList= .clear()) somewhere nearby you may be adding the contents of subjList more = than once.  There=E2=80=99s not enough of your code here to tell for s= ure exactly what=E2=80=99s going on.



<= /div>
------=_Part_1671101_805143146.1567652395250--