I want to use PHP to connect to sql server database.
I installed xampp 1.7.0(php 5.2) and SQLSRV20. I\'ve added the extensions in php.ini and I get thi
Try this to be able to catch the thrown exception:
$server_name = "your server name";
$database_name = "your database name";
try {
$conn = new PDO("sqlsrv:Server=$server_name;Database=$database_name;ConnectionPooling=0", "user_name", "password");
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
$e->getMessage();
}