mybatis批量更新或者插入的时候必须在数据库连接上打开allowMultiQueries选项
2017-03-17 17:57
387 查看
如题!
在spring.datasource.url后加上allowMultiQueries=true
如:jdbc:mysql://10.10.20.36:3306/test?allowMultiQueries=true
否则会报错:
[org.apache.ibatis.session.defaults.DefaultSqlSession@76a2f910]
org.springframework.jdbc.BadSqlGrammarException:
### 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 b_email_msg_remind
SET send_status = 1, send_email_code='abc@abc.abc'' at line 6
### The error may involve com.hhsoft.sectionservice.model.persistence.EmailMapper.updateEmailTasks-Inline
### The error occurred while setting parameters
### 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 staff
SET status = 1, send_email_code='abc@abc.abc';<span style="font-family: Helvetica, Tahoma, Arial, sans-serif;">update sta<span style="font-size:10px;">ff SET status = 2,</span> send_email_code='test@qq.com' </span>' at line 6
; bad SQL grammar []; nested exception is 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 b_email_msg_remind
SET send_status = 1, send_email_code='abc@abc.abc'' at line 6
在spring.datasource.url后加上allowMultiQueries=true
如:jdbc:mysql://10.10.20.36:3306/test?allowMultiQueries=true
否则会报错:
[org.apache.ibatis.session.defaults.DefaultSqlSession@76a2f910]
org.springframework.jdbc.BadSqlGrammarException:
### 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 b_email_msg_remind
SET send_status = 1, send_email_code='abc@abc.abc'' at line 6
### The error may involve com.hhsoft.sectionservice.model.persistence.EmailMapper.updateEmailTasks-Inline
### The error occurred while setting parameters
### 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 staff
SET status = 1, send_email_code='abc@abc.abc';<span style="font-family: Helvetica, Tahoma, Arial, sans-serif;">update sta<span style="font-size:10px;">ff SET status = 2,</span> send_email_code='test@qq.com' </span>' at line 6
; bad SQL grammar []; nested exception is 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 b_email_msg_remind
SET send_status = 1, send_email_code='abc@abc.abc'' at line 6
相关文章推荐
- vc++连接mysql数据库,并对数据库中的表进行查询、插入、删除、更新等
- DButils工具类可以用来获取数据库连接向数据库插入更新删除对象2
- Python开发SQLite3数据库相关操作详解【连接,查询,插入,更新,删除,关闭等】
- 数据库插入或者更新操作的方法实现
- C#中往数据库插入/更新时候关于NUll空值的处理
- C#连接数据库和插入、删除、更新数据库
- 【BUG】插入或者更新超过限制后写入数据库失败
- python连接数据库(3)插入更新和删除
- 【SQLServer】【恢复挂起的解决方案】附加文件时候的提示“无法重新生成日志,原因是数据库关闭时存在打开的事务/用户,该数据库没有检查点或者该数据库是只读的。 ”【数据库恢复】
- WPF连接SQL数据库,将TextBox中填写的数据插入数据库中,并更新DataGrid表
- 怎么解决php调用数据的值或者插入数据库的时候乱码的问题
- thinkphp 在数据库更新(save)的时候,如果字段没有被修改,会更新失败 和数据的自动验证,插入的时候可以自动验证,但更新的时候就不能验证了
- C#连接Access数据库,Update更新数据时出现“不能打开数据库,应用程序可能无法识别该数据库。。。”错误
- c#.net数据库连接 查询,删除 ,插入 ,更新
- DButils工具类可以用来获取数据库连接向数据库插入更新删除对象
- 数据库更新,当主键为自增列是,插入或者更新的方法
- DButils工具类能够用来获取数据库连接向数据库插入更新删除对象2
- jdbc连接数据库的7大步骤(以通过jdbc连接实现数据的插入、更新为例)
- java连接数据库后进行更新插入操作
- DButils工具类能够用来获取数据库连接向数据库插入更新删除对象