ibatis防止SQL注入的办法

时间:2016-02-18 11:42:49   收藏:0   阅读:252

常见容易犯错的写法: 

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 like CONCAT(‘%‘,#title#,‘%‘) 
在mssql中,用这个: select * from page_frame where ‘%‘+#name #+‘%  

原文:http://www.cnblogs.com/zhw2016/p/5197466.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!