我先用StringBuffer把sql语句拼接起来(sb="sql1;sql2;"),
再用jdbcTemplate.batchUpdate(sql);执行,数据能全部插入数据库,但是框架报了错误:
org.springframework.jdbc.UncategorizedSQLException: StatementCallback; uncategorized SQLException for SQL[Sql语句]
SQL state [null]; error code [0]; An SQLException was provoked by the following failure: java.lang.ArrayIndexOutOfBoundsException: 1; nested exception is java.sql.SQLException: An SQLException was provoked by the following failure: java.lang.ArrayIndexOutOfBoundsException: 1
以下是sql:insert into enterarea(writeTime,commitTime,coCode,serialNumber,relTransNo,msgUid,trafMode,shipNameEn,voyageNo,billNo,orgCode,goodsNo,cargoCrossId,unitCode,quantity) values('2017-11-09 16:35:20','20171109163520','NII1X8N','NII1X8N2017110999728934377','NII1X8N2017110999728934377','','ky','','','','311010',1,'310010062810001100001','null',32)