MySQL连接数据库时,添加语句:“allowMultiQueries=true”的作用:
1.可以在sql语句后携带分号,实现多语句执行。
可以执行批处理,同时发出多个SQL语句。
sql语句
不加allowMultiQueries=true之前,会报错文章来源:https://www.toymoban.com/news/detail-517477.html
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 '=ticket-1 where id = 1
;
update ticket ticket=ticket-1 wh' at line 1
### The error may exist in file [F:\test\my1\target\classes\mapper\TicketMapper..xml]
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: update ticket ticket=ticket-1 where id = ? ; update ticket ticket=ticket-1 where 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 '=ticket-1 where id = 1
;
update ticket ticket=ticket-1 wh' at line 1
; 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 '=ticket-1 where id = 1
;
update ticket ticket=ticket-1 wh' at line 1
加了之后文章来源地址https://www.toymoban.com/news/detail-517477.html
到了这里,关于allowMultiQueries=true的作用的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!