温馨提示×

ibatis怎么防止sql注入

小新
340
2021-01-07 11:19:33
栏目: 云计算
开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

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

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读:动态sql如何防止sql注入

0