allowMultiQueries=true的作用
•
数据库
MySQL连接数据库时,添加语句:“allowMultiQueries=true”的作用:
1.可以在sql语句后携带分号,实现多语句执行。
-
可以执行批处理,同时发出多个SQL语句。
sql语句
不加allowMultiQueries=true之前,会报错
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://net2asp.com/b98ea760de.html
