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
加了之后
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐


所有评论(0)