Ralph M. Rivera
Ralph M. Rivera

Reputation: 789

When using PHP on Windows, what is better (1) the native driver for SQL Server or (2) the PDO driver?

I am using PHP 5.3.6 on Windows and connecting to a SQL Server 2008 database.

According to the docs at MSDN there are two drivers for me to choose from.

php_sqlsrv_53_nts_vc9.dll

php_pdo_sqlsrv_53_nts_vc9.dll

The documentation on how to use each is great, but I'm not sure why I would use one over the other.

Can someone provide some insight on what the fundamental differences are (other than syntax) and why one is better than the other?

Upvotes: 6

Views: 1325

Answers (1)

Marc Towler
Marc Towler

Reputation: 705

The bonus to using PDO is that if your hosting environment changes to Linux or SQL Server is not available then there is very little that you will need to change. The connection string, where you specify what sort of database (SQL Server, MySQL, SQLite etc) would be the main if not the only change needed. (apart from how you format your queries)

Upvotes: 1

Related Questions