1、在连接字符串中加入 allowMultiQueries=true 参数
如
<property name="driverUrl" value="jdbc:mysql://192.168.1.102:3306/dbname?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true"/>
2、xml中加入分号
update device set space= #{space};
update users set backuptime=NOW() where userid = #{userid};
本文介绍了如何通过在MySQL连接字符串中添加特定参数实现单次连接执行多条SQL语句的方法。主要内容包括设置允许多查询的参数及在XML文件中正确使用分号隔开不同SQL语句。
1301

被折叠的 条评论
为什么被折叠?



