java - org.postgresql.util.PSQLException: No value specified for parameter 1. - Postgres -


i trying run preparedstatement , getting following exception.

org.postgresql.util.psqlexception: no value specified parameter 1.     @ org.postgresql.core.v3.simpleparameterlist.checkallparametersset(simpleparameterlist.java:257)     @ org.postgresql.core.v3.queryexecutorimpl.execute(queryexecutorimpl.java:284)     @ org.postgresql.jdbc.pgstatement.executeinternal(pgstatement.java:428)     @ org.postgresql.jdbc.pgstatement.execute(pgstatement.java:354)     @ org.postgresql.jdbc.pgpreparedstatement.executewithflags(pgpreparedstatement.java:169)     @ org.postgresql.jdbc.pgpreparedstatement.executequery(pgpreparedstatement.java:117)     @ org.apache.tomcat.dbcp.dbcp2.delegatingpreparedstatement.executequery(delegatingpreparedstatement.java:82)     @ org.apache.tomcat.dbcp.dbcp2.delegatingpreparedstatement.executequery(delegatingpreparedstatement.java:82)     @ com.eventory.dao.managerdao.isexists(managerdao.java:62)     @ com.eventory.create.web.msignup.dopost(msignup.java:44)     @ javax.servlet.http.httpservlet.service(httpservlet.java:661)     @ javax.servlet.http.httpservlet.service(httpservlet.java:742)     @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:231)     @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:166)     @ org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52)     @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:193)     @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:166)     @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:198)     @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:96)     @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:478)     @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:140)     @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:80)     @ org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:650)     @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:87)     @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:342)     @ org.apache.coyote.http11.http11processor.service(http11processor.java:799)     @ org.apache.coyote.abstractprocessorlight.process(abstractprocessorlight.java:66)     @ org.apache.coyote.abstractprotocol$connectionhandler.process(abstractprotocol.java:868)     @ org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint.java:1457)     @ org.apache.tomcat.util.net.socketprocessorbase.run(socketprocessorbase.java:49)     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1149)     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:624)     @ org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61)     @ java.lang.thread.run(thread.java:748) sep 10, 2017 8:15:20 pm org.apache.catalina.core.standardwrappervalve invoke severe: servlet.service() servlet [com.eventory.create.web.msignup] in context path [/eventory] threw exception java.lang.illegalstateexception: cannot forward after response has been committed     @ org.apache.catalina.core.applicationdispatcher.doforward(applicationdispatcher.java:321)     @ org.apache.catalina.core.applicationdispatcher.forward(applicationdispatcher.java:311)     @ com.eventory.create.web.msignup.dopost(msignup.java:52)     @ javax.servlet.http.httpservlet.service(httpservlet.java:661)     @ javax.servlet.http.httpservlet.service(httpservlet.java:742)     @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:231)     @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:166)     @ org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52)     @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:193)     @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:166)     @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:198)     @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:96)     @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:478)     @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:140)     @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:80)     @ org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:650)     @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:87)     @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:342)     @ org.apache.coyote.http11.http11processor.service(http11processor.java:799)     @ org.apache.coyote.abstractprocessorlight.process(abstractprocessorlight.java:66)     @ org.apache.coyote.abstractprotocol$connectionhandler.process(abstractprotocol.java:868)     @ org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint.java:1457)     @ org.apache.tomcat.util.net.socketprocessorbase.run(socketprocessorbase.java:49)     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1149)     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:624)     @ org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61)     @ java.lang.thread.run(thread.java:748) 

this method in managerdao causing exception.

public static boolean isexists(string managerid) {         boolean st = false;          // sql = "select managerid managerlogin";         try {             pstmt = currentcon.preparestatement(get_manager_password);              resultset rs = pstmt.executequery();             while (rs.next()) {                 string originalmid = rs.getstring("managerid");                 if (originalmid.equals(managerid)) {                     st = true;                 }             }         } catch (sqlexception e) {             // todo auto-generated catch block             e.printstacktrace();         }         return st;     } 

the preparedstatement are

get_manager_password = "select pwd managerlogin managerid=?"; 

this working fine when using ms sql server. have switched postgres. there wrong query? please help.

you don't pass parameter managerid anywhere in query statement

should this:

pstmt = currentcon.preparestatement(get_manager_password); pstmt.setstring(1, managerid); resultset rs = pstmt.executequery(); //rest of code 

the rest of code not make sense comments of @realskeptic mention


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -