参数化查询为什么能够防止SQL注入 http://netsecurity.51cto.com/art/201301/377209.htm OleDbDataAdapter Class http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbdataadapter.aspx Sql Server 编译.重编译与执行计划重用原理 http://www.2cto.com/database/201301/183262.html SQL
#{xxx},使用的是PreparedStatement,会有类型转换,所以比较安全: ${xxx},使用字符串拼接,可以SQL注入: like查询不小心会有漏洞,正确写法如下: Mysql: select * from t_user where name like concat('%', #{name}, '%') Oracle: select * from t_user where name like '%' || #{name} || '%' SQLServer: selec