hello there, This is the code snippet iv written but the problem is its not inserting all the items in the String object , its inserting only the first value i.e l[0] and kp[0]. What corrections should i make to insert all the elements of the String object please let me know the corrections. Regards varsha void insertResults(String l[],String kp[],String tName)throws Exception { Connect(); String cmd="insert into "+tName+" values(?,?)"; PreparedStatement pst=null; pst=con.prepareStatement(cmd); for(int i=0;i<kp.length;i++) {
There's nothing wrong with that that I can see, although clearParameters is unneeded; it should be harmless functionally and not really significant in terms of performance..
It's possible that the 2nd insert is throwing an exception, perhaps because of a constraint violation, so look at your exception logs, if you haven't.
It's also possible that your driver/database is simply broken and doesn't support this correctly.