惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Privacy & Cybersecurity Law Blog
V
V2EX
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Register - Security
The Register - Security
MongoDB | Blog
MongoDB | Blog
P
Privacy International News Feed
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
美团技术团队
Stack Overflow Blog
Stack Overflow Blog
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
K
Kaspersky official blog
S
Secure Thoughts
T
Tenable Blog
Security Latest
Security Latest
The Cloudflare Blog
S
Security @ Cisco Blogs
H
Heimdal Security Blog
aimingoo的专栏
aimingoo的专栏
TaoSecurity Blog
TaoSecurity Blog
Blog — PlanetScale
Blog — PlanetScale
Microsoft Security Blog
Microsoft Security Blog
Schneier on Security
Schneier on Security
Webroot Blog
Webroot Blog
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Scott Helme
Scott Helme
IT之家
IT之家
Latest news
Latest news
The Hacker News
The Hacker News
C
Check Point Blog
T
The Exploit Database - CXSecurity.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
腾讯CDC
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
N
News | PayPal Newsroom
Forbes - Security
Forbes - Security
P
Palo Alto Networks Blog
S
Security Affairs
S
Securelist
Google Online Security Blog
Google Online Security Blog
WordPress大学
WordPress大学
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
A
About on SuperTechFans

博客园 - le.li

python: 安装python 依赖pip install xxx报错,'pip' 不是内部或外部命令,也不是可运行的程序 nginx:普通用户使用80端口启动nginx报错,nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied) redis:linux安装redis nginx:linux系统安装nginx linux:su切换用户后ll报错 JDK:Linux下载安装jdk1.8 Redis:访问redis报错(error) NOAUTH Authentication required idea:打开黑屏 android: onClick与onTouch冲突,onclick事件没有触发 [Mysql]快速执行sql文件 [JAVA]JDK多版本设置 Android: 添加默认菜单 Android:android studio使用本地路径依赖 [idea]mvn install没有问题,idea build报错:java: Compilation failed: internal java compiler error Android:adb devices返回设备状态offline Wireshark:记一次抓包过程 Android:adb查看手机启动端口 Android:androidx.appcompat.app.AppCompatActivity添加返回按钮 Android:查看依赖
JAVA: Mybatis添加xml执行多行更新语句时报错
le.li · 2025-10-09 · via 博客园 - le.li

tableMapper.xml

<update id="updateTables" parameterType="Table">
    <foreach collection="tableList" item="item" separator=";">
        update tb_test
        <trim prefix="SET" suffixOverrides=",">
            <if test="item.name != null">title = #{item.name},</if>
        </trim>
        where id = #{item.id}
    </foreach>
</update>

### Cause: java.sql.SQLSyntaxErrorException: 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 

检查了sql和单独执行,都没有问题

搜索发现,是出于安全安全,连接数据库不允许使用分号,即不允许一次执行多行sql

解决:

修改数据库连接URL配置添加允许使用分号allowMultiQueries=true

 jdbc:mysql://localhost:3306/test_db?allowMultiQueries=true

备注:

允许使用分号,意味更多的注入风险,校验好用户输入的内容