ibatis sql注入

ibatis怎么防止sql注入

小新
327
2021-01-07 11:19:33
栏目: 云计算

ibatis怎么防止sql注入

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},+'%'

0
看了该问题的人还看了