Jireh程序猿的那些事 Jireh程序猿的那些事

记录分享生活、程序、信息的精彩人生

目录
Mybatis多条SQL执行出现的问题
/      

Mybatis多条SQL执行出现的问题

之前写的一个关联删除的功能报错了,Log 中提示

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 ‘delete from baseface.ATT_USERPICTURE where STAFF_ID=’0f2cb73ba69c4bbbbb73ffe88e7’ at line 8

语句一看没毛病,怎会还会报错呢。查询了相关资料,MySQL 驱动默认没有开启批量执行 SQL 的开关,需要我们在配置文件中添加 allowMultiQueries 参数,设置为 true

url2:jdbc:mysql://localhost:3306/database?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&allowMultiQueries=true

如果觉得这篇文章不错的话,请我喝一杯 咖啡☕吧
标题:Mybatis多条SQL执行出现的问题
作者:Jireh
地址:https://jireh.xyz/articles/2020/03/10/1583806005977.html
本作品由 Jireh 采用 署名 – 非商业性使用 – 禁止演绎 4.0 国际许可协议进行许可,转载请注明出处。