SQL Server データベースに接続しようとしていますが、次のメッセージが表示され続けます。
Array ( [0] => Array ( [0] => 28000 [SQLSTATE] => 28000 [1] => 18456
[code] => 18456 [2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'NT AUTHORITY\SYSTEM'. [message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'NT AUTHORITY\SYSTEM'. )
[1] => Array ( [0] => 42000 [SQLSTATE] => 42000 [1] => 4060
[code] => 4060[2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "Store" requested by the login. The login failed.
[message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "Store" requested by the login. The login failed. )
[2] => Array ( [0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'NT AUTHORITY\SYSTEM'.
[message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'NT AUTHORITY\SYSTEM'. )
[3] => Array ( [0] => 42000 [SQLSTATE] => 42000 [1] => 4060
[code] => 4060 [2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "Store" requested by the login. The login failed.
[message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "Store" requested by the login. The login failed. ) )
その NT AUTHORITY\SYSTEM ユーザーが何であるかさえ理解できません。Apacheで実行しています。
UPD:コードを追加するのを忘れました
<?php
$servername="(local)";
$connection=array("Database"=>"Store");
$link = sqlsrv_connect($servername,$connection);
if( $link )
{
echo "Connection established.\n";
}
else
{
echo "Connection could not be established.\n";
die( print_r( sqlsrv_errors(), true));
}
?>
UPD2: 問題が解決しました。いつものように、私はいくつかの助けを借りようとしました。NT Authority\System ユーザーとは何かを説明していただきありがとうございます。Apacheを実行しているユーザーを、sqlserverに使用されているユーザーに変更し、機能しました。