1
Vote

Failover_Partner / Microsoft Drivers for PHP for SQL Server Version 3.2

description

Hi,
I hope someone can help me.
I have sucessfully installed "PHP 5.4.45" and "Microsoft Drivers for PHP for SQL Server" Version 3.2 on my Windows Server 2008R2 Server.
All is running fine, except the "Failover_Partner" value.
Hope someone can find the problem.
Thank you.


SQL2012 Mirror: svr02a.company.local
SQL2012 Principal: svr01a.company.local

Here is my test-php-script:


<?php
$hostname = 'svr02a.company.local';
$connection_options = array('Database'=>'DB', 'UID'=>'DB_User', 'PWD'=>'PaSSw0Rd!', 'Failover_Partner'=>'svr01a.company.local');
$conn = sqlsrv_connect($hostname, $connection_options);
if(!is_resource($conn)){ echo 'Could not connect: '; var_dump(sqlsrv_errors(SQLSRV_ERR_ALL)); exit(0); }
echo 'Connection established successfully.';
sqlsrv_close($conn);
?>


Actually I would expect that if the SQL Driver could not connect to svr02a.company.local because it's the mirror, the script/driver retry to connect to svr01a.company.local and establish a sucessfully connection.
Instead I get this error message:
Could not connect: array(4) { [0] => array(6) { [0] => string(5) "28000" 'SQLSTATE' => string(5) "28000" [1] => int(18456) 'code' => int(18456) [2] => string(85) "[Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Login failed for user 'DB_User'." 'message' => string(85) "[Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Login failed for user 'DB_User'." } [1] => array(6) { [0] => string(5) "42000" 'SQLSTATE' => string(5) "42000" [1] => int(4060) 'code' => int(4060) [2] => string(125) "[Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Cannot open database "DB" requested by the login. The login failed." 'message' => string(125) "[Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Cannot open database "DB" requested by the login. The login failed." } [2] => array(6) { [0] => string(5) "01000" 'SQLSTATE' => string(5) "01000" [1] => int(5701) 'code' => int(5701) [2] => string(91) "[Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Changed database context to 'DB'." 'message' => string(91) "[Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Changed database context to 'DB'." } [3] => array(6) { [0] => string(5) "01000" 'SQLSTATE' => string(5) "01000" [1] => int(5703) 'code' => int(5703) [2] => string(93) "[Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Changed language setting to us_english." 'message' => string(93) "[Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Changed language setting to us_english." } }

When I set
$hostname = 'svr01a.company.local';
and
'Failover_Partner'=>'svr02a.company.local'
all is running fine with my webapplication.
Or if I switch the mirror-status (mirror <-> principal).

But for me it seems that Failover_Partner value is ignored by Microsoft Drivers for PHP for SQL Server Version 3.2

comments