mysql批量更新|mybatis批量操作
新搭建一个项目spring boot + mybatis + mysql
【mysql批量更新|mybatis批量操作】批量更新操作一直报错,错误如下:
文章图片
### The error may involve com.test.dao.test.ITestDao.batchUpdateTest-Inline
### The error occurred while setting parameters
### SQL: UPDATE t_test
SET test_num = ?,update_time = ?, update_user = ?
WHERE
test_id = ?;
UPDATE t_test
SET test_num = ?, update_time = ?, update_user = ?
WHERE
test_id = ?;
UPDATE t_test
SET test_num = ?, update_time = ?, update_user = ?
WHERE
test_id = ?
### 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 t_test
SET test_num = 25,
' at line 14
一直以为是拼装的SQL语句语法有问题,把拼装更新SQL语句放入到Navicat Premium 中执行又没有问题
搜索资料mysql批量更新需要手动设置:
只要在jdbc.url中加上以下内容就可以
allowMultiQueries=true
文章图片
推荐阅读
- 六月更新的......
- py连接mysql
- 2019-01-18Mysql中主机名的问题
- MySql数据库备份与恢复
- mysql|InnoDB数据页结构
- mysql中视图事务索引与权限管理
- MYSQL主从同步的实现
- MySQL数据库的基本操作
- javaweb|基于Servlet+jsp+mysql开发javaWeb学生成绩管理系统
- Python3|Python3 MySQL 数据库连接