首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

ibatis防止SQL流入的办法

2012-09-08 
ibatis防止SQL注入的办法常见容易犯错的写法: select * from page_frame where title like %$title$% 这

ibatis防止SQL注入的办法
常见容易犯错的写法:

select * from page_frame where title like '%$title$%'


这样会引起SQL注入漏洞.

解决方法:

select * from page_frame where title like '%'||#title#||'%'

注意:以上写法在oracle使用。

在mysql中,用这个: select * from page_frame where title CONCAT('%',#title#,'%')
在mssql中,用这个: select * from page_frame where '%'+#name #+'%?? 还有一种办法是将参数里的# $ ' 等字符串转义替换掉

热点排行