批量更新异常
来源:7-6 部门列表树型结构界面开发

smile_小肥仔
2018-08-19
老师好
开始报的异常如下,将xml里foreach方法的dept改为sysDept还是报下面的异常
### Error updating database. Cause: java.sql.SQLException: sql injection violation, multi-statement not allow : UPDATE sys_dept
SET level = ?
WHERE id = ?
改了DruidDataSource配置文件后,不报上面的异常,但是执行批量更新时会出现这个异常,请问要怎么解决?
### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE sys_dept
SET dept_level = '0.11'
WHERE id = 3
;
U' at line 5
### The error may involve com.permission.dao.SysDeptMapper.batchUpdateLevel-Inline
### The error occurred while setting parameters
### SQL: UPDATE sys_dept SET dept_level = ? WHERE id = ? ; UPDATE sys_dept SET dept_level = ? WHERE id = ? ; UPDATE sys_dept SET dept_level = ? WHERE id = ?
1回答
-
你好,这是之前其他学员在这里出现过的问题,http://coding.imooc.com/learn/questiondetail/32556.html
我看你目前的报错的位置,是在UPDATE的U这附近有问题,怀疑是分号的问题,你看看你是否使用的中文分号,而不是英文分号(我单独拷贝你的sql里的分号是英文格式的,这弄的我有点不敢完全确定是这个导致的)。如果不是这个问题,可能也需要在db的连接串末尾加上 &allowMultiQueries=true
012018-08-19
相似问题