5
I’m using the following code:
try {
$con = new PDO("sqlsrv:Server=172.20.21.193,9090;Database=sgt","deb","123123");
$con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
die ("Erro na conexao com o banco de dados: ".$e->getMessage());
}
but is giving error when trying to connect. PDO driver is installed. Which other library or driver should I install so my application can access the database? PHP version is 5.6.9 (Linux Debian 8.1) and Sqlserver is 2008 (access will be remote).
Which error appears?
– rray
This "could not find driver"
– Deb
You need to install it first, see the procedure on this link http://answall.com/q/48078/91
– rray
Even for Linux? These would be the steps?
– Deb
On Linux, I can’t say, edit the question and add this information in more detail helps other users to answer better.
– rray
Try PDO_DBLIB: http://php.net/manual/en/ref.pdo-dblib.php or PDO_ODBC with linux driver, as described here: http://php.net/manual/en/ref.pdo-sqlsrv.php
– jflizandro