java.sql.SQLException: ORA-01008: not all variables bound -



java.sql.SQLException: ORA-01008: not all variables bound -

i trying insert values oracle database 10g express edition retrieved through form. here code,

package com.cid_org.model; import java.sql.connection; import java.sql.preparedstatement; import java.sql.resultset; import java.sql.sqlexception; //import java.util.collection; //import java.util.iterator; import java.util.map; public class crimereportpojo { private map<string,string[]> complaintformdata; private connection connection; private int complaintid=0; public crimereportpojo(map<string,string[]> complaintformdata,connection connection){ this.complaintformdata = complaintformdata; this.connection = connection; sendcrimedata(); } private void sendcrimedata(){ try{ string query_victim_details ="insert victim_details ("+ "victim_first_name,"+ "victim_middle_name,"+ "victim_last_name,"+ "victim_uid_no,"+ "victim_age,"+ "victim_gender,"+ "victim_address,"+ "nearest_police_chowki,"+ "victim_zip_code,"+ "victim_phone_no,"+ "victim_email_address,"+ "complaint_id)"+ "values(?,?,?,?,?,?,?,?,?,?,?,?)"; string query_victimizer_details ="insert victim_details ("+ "victimizer_business_name,"+ "victimizer_first_name,"+ "victimizer_middle_name,"+ "victimizer_last_name,"+ "victimizer_gender,"+ "victimizer_address,"+ "victimizer_zip_code,"+ "victimizer_phone_no,"+ "victimizer_email_address,"+ "complaint_id)"+ "values(?,?,?,?,?,?,?,?,?,?)"; string query_complaint_description ="insert complaint_description ("+ "complaint_id,"+ "complaint_desc,"+ "complaint_time_stamp)"+ "values(?,?,?)"; string query_complaint_count_details ="insert complaint_count_details("+ "victim_uid_no,"+ "complaint_count)"+ "values(?,?)"; preparedstatement ps = connection.preparestatement(query_victim_details); /*now, lets extract info inserted map object * , phone call setstring() methods on values */ /*collection<string[]> c = complaintformdata.values(); iterator<string[]> = c.iterator(); int i=1; while(it.hasnext()){ string[] s = it.next(); ps.setobject(i, (object)s[0] ); i++; }*/ string[] s= complaintformdata.get("personal_first_name"); system.out.println(s[0]); system.out.println(s); ps.setstring(1,s[0]); s= complaintformdata.get("personal_middle_name"); ps.setstring(2,s[0]); s= complaintformdata.get("personal_last_name"); ps.setstring(3,s[0]); s= complaintformdata.get("personal_aadhar_card_no"); system.out.println(integer.parseint(s[0])); ps.setint(4,integer.parseint(s[0]) ); s= complaintformdata.get("personal_age"); ps.setint(5,integer.parseint(s[0])); s= complaintformdata.get("personal_gender"); ps.setstring(6,s[0]); s= complaintformdata.get("personal_address"); ps.setstring(7,s[0]); s= complaintformdata.get("police_chowki"); ps.setstring(8,s[0]); s= complaintformdata.get("personal_zip_code"); ps.setint(9,integer.parseint(s[0])); s= complaintformdata.get("personal_phone_no"); ps.setint(10,integer.parseint(s[0])); s= complaintformdata.get("personal_email_id"); ps.setstring(11,s[0] ); system.out.println(s[0]); /*to insert complaint id lastly column complaint_id * calling getcomplaintid() method tells me whether * first time inserting database or there * complaints registered*/ complaintid = getcomplaintid(); system.out.println(complaintid); if(complaintid==-2){ //first time ps.setint(12,1); } else{ ps.setint(12,++complaintid); } ps.executeupdate(query_victim_details); }catch(exception e){ e.printstacktrace(system.out); system.out.println(e); } } private int getcomplaintid(){ string query = "select max(complaint_id)"+ "from complaint_description"; seek { preparedstatement ps = connection.preparestatement(query); resultset rs = ps.executequery(); if(rs.next()){ homecoming rs.getint(1); } else{ /*-2 indicates table empty , first **complaint beingness registered*/ homecoming -2; } } grab (sqlexception e) { e.printstacktrace(); } /*the syntax compels homecoming integer value*/ homecoming -1; } }

the problem getting next exception:

java.sql.sqlexception: ora-01008: not variables bound

the stack trace is:

at oracle.jdbc.driver.databaseerror.throwsqlexception(databaseerror.java:112) @ oracle.jdbc.driver.t4cttioer.processerror(t4cttioer.java:331) @ oracle.jdbc.driver.t4cttioer.processerror(t4cttioer.java:288) @ oracle.jdbc.driver.t4c8oall.receive(t4c8oall.java:743) @ oracle.jdbc.driver.t4cpreparedstatement.dooall8(t4cpreparedstatement.java:216) @ oracle.jdbc.driver.t4cpreparedstatement.executeforrows(t4cpreparedstatement.java:955) @ oracle.jdbc.driver.oraclestatement.doexecutewithtimeout(oraclestatement.java:1169) @ oracle.jdbc.driver.oraclestatement.executeupdateinternal(oraclestatement.java:1615) @ oracle.jdbc.driver.oraclestatement.executeupdate(oraclestatement.java:1580) @ com.cid_org.model.crimereportpojo.sendcrimedata(crimereportpojo.java:130) @ com.cid_org.model.crimereportpojo.<init>(crimereportpojo.java:20) @ com.cid_org.controller.crimereportcontrollerservlet.dopost(crimereportcontrollerservlet.java:52) @ javax.servlet.http.httpservlet.service(httpservlet.java:646) @ javax.servlet.http.httpservlet.service(httpservlet.java:727) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:303) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:208) @ org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:241) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:208) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:220) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:122) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:501) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:171) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:102) @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:950) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:116) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:408) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1040) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:607) @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:314) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) @ org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) @ java.lang.thread.run(thread.java:722)

here victim_details table:

http://i.stack.imgur.com/1teik.png

and here complaint_description table,

http://i.stack.imgur.com/qxvpn.png

what have tried: inserted next statement

system.out.println(complaintid);

after calling getcomplaintid() method , output got on console matches in table(i have cross checked it) , indicates code reaches there indicates getcomplaintid() method executed.

also, left no value null in form , values constraint table format.

perhaps seek calling executeupdate() no parameters. you've set query string when created preparedstatement.

ps.executeupdate()

java sql oracle

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -