Pdo connection sql server

Posted on 12.06.2018 by Marcel
I am trying to connect to an existing SQL Server database using PDO with the drivers provided by Microsoft. Microsoft Drivers for PHP for SQL Server. I use FreeTDS to connect to Microsoft SQL servers from a Linux server and it looks like the person in the link above has used FreeTDS to connect from a Mac. Prepared Statements protect from SQL injection, and are very important for web application security.

I have seen examples using odbc, dblib, mssql, etc.

Improve script portability by accessing SQL Server from PDO, PHP's object oriented data access abstraction layer. Both support Prepared Statements. The spaces don't cause problems when using the same syntax to connect to mysql, so I'm guessing it's a Microsoft thing.

With MySQLi, you will need to rewrite the entire code - queries included.

I only I could bill them for the time I've wasted. However I believe the connection string with these drivers should use 'sqlsrv'. A string that contains the user's password.