I have this error when I try to connect from a Server called: AplicationServer1 to another server in the same domain Kobl, called DatabaseServer1
SQLSTATE[28000]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'KOBL\kobladmin'.
The first strange thing is in DatabaseServer1 has Sql Server 2008 R2 with Sql Native Client 10.0 and I dont know why appear 11.0 versión in the above line when I try to connect to DatabaseServer in browser.
I'm using on side AplicationServer1:
- PHP 5.4
- IIS 7
DatabaseServer1:
- Sql Server 2008 R2
I'm use that code to make connection:
config.php
<?php
define ("DB_USER","KOBL\kobladmin");
define ("DB_PASS","AdminKobl");
define ("DSN","sqlsrv:server=databasebserver1.kobl.com;database=kobl_system");
?>
connect.php
<?php
require 'config.php';
class DB_Connect {
private static $_instance;
//Connecting to database
public function &pdo_connect() {
if(!self::$_instance) {
try{
self::$_instance = new PDO(DSN,DB_USER, DB_PASS);
self::$_instance->setAttribute(PDO::ATTR_PERSISTENT, true);
self::$_instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $ex) {
die("PDO Connection error: ".$ex->getMessage()."<br/>");
}
}
return self::$_instance;
}
private function __construct() {
}
private function __clone() {
}
}
?>
Credential to connect Sql Server is the same that Windows Authentication.
Note: Names of domain, user and password are fake (I put that because sometimes say me "You couldn't put real data of your database connection".