How can prepared statements protect from SQL injection attacks?

前端 未结 9 2070
予麋鹿
予麋鹿 2020-11-21 05:40

How do prepared statements help us prevent SQL injection attacks?

Wikipedia says:

Prepared statements are resilient against SQL injection, because

9条回答
  •  一个人的身影
    2020-11-21 06:05

    ResultSet rs = statement.executeQuery("select * from foo where value = " + httpRequest.getParameter("filter");
    

    Let’s assume you have that in a Servlet you right. If a malevolent person passed a bad value for 'filter' you might hack your database.

提交回复
热议问题