AnsweredAssumed Answered

Connecting to SQL Server

Question asked by sarojthapa60 on Aug 15, 2016

We have a database in SQL Server platform in ArcGIS desktop. I am trying to connect to this database using PHP_PDO_SQLSRV. When I try this, I get a fatal error. The codes used to connect to the database:

$serverName = 'SERVERNAME';

$connectionInfo=array('Database'=>'DATABASE', 'UID'=>'USERNAME', 'PWD' => 'PASSWORD');

$conn=sqlsrv_connect($serverName, $connectionInfo);
if($conn){
    echo "Connection to SQL Server is successful! </br>";
}else{
    echo "Connection failed! </br>";
    die(print_r(sqlsrv_errors(),TRUE));
}

I get the following error:

Fatal error: Call to undefined function sqlsrv_connect() in the line $conn=sqlsrv_connect();

Could anyone please help me with this?

Thanks 

 

Outcomes