ibatis怎么防止sql注入

lewis 2018-12-04 20次阅读

ibatis防止sql注入的方法:

使用#写法采用预编译方式,将转义交给数据库,则不会出现注入问题,例如:

//mysql环境

select * from test where school_name like concat('%',${name},'%')

//oracle环境

select * from test where school_name like '%'||${name},'%'

//SQL Server环境

select * from test where school_name like '%'+${name},+'%'



发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。