• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.sql.SQLException : Missing IN or OUT parameter at index:: 1

 
toukhir mujawar
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i m trying to insert some values into the database and getting this message..

java.sql.SQLException: Missing IN or OUT parameter at index:: 1


the code is as below...


PreparedStatement st = conn.prepareStatement("insert into tbl_jv01 (rec_type,sys_code,bu,pc_mth,pc,zone,circle,div,subdiv,jv_cat,trf_cd,amt_type,amount,acct_type,cc_code,std_mth,pr_mth,bill_dt,due_dt,run_dt,run_time,rtrf,prc_mth,version,tag1) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
ResultSet rs = st.executeQuery();
st.setString(1,getRecType());
st.setString(2,getSysCode());
st.setInt(3,getBu());
st.setInt(4,getPcMth());
st.setInt(5,getPc());
st.setInt(6,getZone());
st.setInt(7,getCircle());
st.setInt(8,getDiv());
st.setInt(9,getSubDiv());
st.setInt(10,getJvCat());
st.setInt(11,getTrfCd());
st.setInt(12,getAmtType());
st.setBigDecimal(13,getAmount());
st.setString(14,getAcctType());
st.setInt(15,getCcCode());
st.setInt(16,getStdMth());
st.setInt(17,getPrMth());
st.setInt(18,getBillDt());
st.setInt(19,getDueDt());
st.setInt(20,getRunDt());
st.setString(21,getRunTime());
st.setInt(22, getRtrf());
st.setInt(23,getPrcMth());
st.setInt(24,getVersion());
st.setInt(25,getTag1());
rs.close();
st.close();

please help me regarding this problem....
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15216
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your statement is an INSERT statement.

ResultSet rs = st.executeQuery();

Here you are executing the statement as if it's a query. That's wrong, it's not a query.


[ October 11, 2006: Message edited by: Jesper Young ]
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our JDBC forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic