mybatis执行多条sql时出现语法异常错误

 

做项目时在一个mybatis中放入2条更新sql ,但是执行出异常,说是语法错误

update miniapp_subject_members set
member_status= -1 where subject_id=#{subject_id} and user_id =#{user_id};

update miniapp_subject set actual_participants_number=actual_participants_number-1
where subject_id=#{subject_id};

 

 

 jdbc连接默认 一次执行一条,如过需要一次执行多个sql 需要开启开关。添加

allowMultiQueries=true  并且注意 每句sql以封号隔开“;”
jdbc:mysql://127.0.0.1:3306/testdb?characterEncoding=utf-8&allowMultiQueries=true

 

转载于:https://www.cnblogs.com/OneDirection/articles/8424567.html

你可能感兴趣的:(mybatis执行多条sql时出现语法异常错误)