为了防止SQL注入,iBatis模糊查询时也要避免使用$$来进行传值.下面是三个不同数据库的ibatis的模糊查询传值。
mysql: select * from stu where name like concat('%',#name #,'%')
oracle: select * from stu where name like '%'||#name #||'%'
SQL Server:select * from stu where name like '%'+#name #+'%
本文深入探讨了在使用IBatis进行数据库操作时,如何避免SQL注入攻击,特别关注了模糊查询中使用$$的问题,并提供了针对MySQL、Oracle和SQL Server的正确传值方法。
为了防止SQL注入,iBatis模糊查询时也要避免使用$$来进行传值.下面是三个不同数据库的ibatis的模糊查询传值。
mysql: select * from stu where name like concat('%',#name #,'%')
oracle: select * from stu where name like '%'||#name #||'%'
SQL Server:select * from stu where name like '%'+#name #+'%

被折叠的 条评论
为什么被折叠?