0

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".

1 Answer 1

1

SQL Native Client 11 appears in the error because that's the version of the client that ApplicationServer1 is using to connect to DatabaseServer1. SQL 2012 client tools must have been installed on the app server.

The authentication issue seems to be that KOBL\kobladmin is does not have the permissions to your database. Make sure you have 1) created a Windows login for that account in SQL Server and then 2) granted that login the appropriate permissions within the kobl_system database.

4
  • It's true, in AplicationServer1 is installed SQL 2012 Native Client but is a problem or not? May 13, 2013 at 18:53
  • No, not a problem. You can potentially have problems going the other way but using SQLNCLI 11 to connect to SQL 2008 R2 should be fine.
    – squillman
    May 13, 2013 at 18:55
  • Ok thanks... and about login, I checked in SQL Server Management Studio in Properties of Database and has KOBL\kobladmin as user.. or I need do another operation or how I check if my database has KOBL/kobladmin as your user to access? May 13, 2013 at 18:58
  • I repair the connection, I had to add a credential parameters in IIS7 in AplicationServer1, thanks for your time. May 13, 2013 at 19:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .