I have a class that I can connect to MySql, and would like to use it to access a database on a local network and that is in SQL SERVER 2014.
private static function Conectar() {
try {
if (self::$Connect == null):
$dsn = 'sqlsrv:host=' . self::$Host . ';database=' . self::$Dbsa;
//$options = [ PDO:: PGSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'];
self::$Connect = new PDO($dsn, self::$User, self::$Pass); //, $options);
self::$Connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
endif;
} catch (PDOException $e) {
PHPErro($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
die;
}
return self::$Connect;
}
But I can not connect because it gives the error of could not find driver
. I already downloaded the version SQLSRV32
, I played it to the C: \ wamp64 \ bin \ php \ php5.6.16 \ ext folder (using wampserver64) , in a notebobok with windows 10 64. Same editing the php.ini
file % and enabling .dll's:
php_pdo_sqlsrv_56_nts
php_pdo_sqlsrv_56_ts
php_sqlsrv_56_ts
php_sqlsrv_56_nts.
Even with all this, I could not connect. How do I achieve this?