數據庫批量更新的坑

 

若一個sql中通過分號分割(或包含)了多個獨立sql

修改數據庫連接配置:&allowMultiQueries=true

官方文檔:

allowMultiQueries
Allow the use of ';' to delimit multiple queries during one statement (true/false), defaults to 'false', and does not affect the addBatch() and executeBatch() methods, which instead rely on rewriteBatchStatements.
Default: false
Since version: 3.1.1

詳細分析見大牛分析底層:Jdbc Url 設置allowMultiQueries爲true和false時底層處理機制研究

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章