Are there any differences between SQL Server and MySQL when it comes to preventing SQL injection?

后端 未结 9 2462
北荒
北荒 2021-02-13 17:21

I am used to developing in PHP/MySQL and have no experience developing with SQL Server. I\'ve skimmed over the PHP MSSQL documentation and it looks similar to MySQLi in some of

相关标签:
9条回答
  • 2021-02-13 17:51

    Stored procedures. That's it. Deny access to any other operation other than executing stored procedures. This way you only allow a certain set of requests to be made to your database, thus eliminating any form of SQL Injection.

    Both support Stored Procedures, BUT, in MSSQL they are easier to debug, because error messages are much clearer.

    0 讨论(0)
  • 2021-02-13 17:53

    Parameterized queries are the way to go. The sqlsrv driver supports parameterized queries. Of course, this will only be useful to you if you are running PHP on Windows. On the chance that you are, there's more information (with examples) here: How and Why to Use Parameterized Queries.

    0 讨论(0)
  • 2021-02-13 17:53

    Any database can be subject to SQL injection attacks. One way to help avoid them is to use Stored Procedures. Both MSSQL & MYSQL support stored procedures.

    0 讨论(0)
提交回复
热议问题