天天看点

对Prepared Statement 是否可以防止 SQL Injection 的实验

代码:

对Prepared Statement 是否可以防止 SQL Injection 的实验
对Prepared Statement 是否可以防止 SQL Injection 的实验

如果我把  pst.setString(1,"3"); //find the customer with cust_id of 3. 改成:

pst.setString(1,"3 or 1 = 1"); 只是执行是无法得到结果而已,并未抓出所有记录。

prepared statement 还是相对的安全,它摒弃了sql语句的拼接。

本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/p/3140698.html,如需转载请自行联系原作者