PHP를 mssql 데이터베이스에 연결하려고합니다. Windows 인증을 사용하거나 만든 사용자를 사용하여 mssql에 로그인 할 수 있습니다. 다음은 PHP 테스트 스크립트입니다PHP를 mssql 데이터베이스에 연결
<?php
$serverName = "SUPERMAN";
$connectionInfo = array('Database'=>'xikwambene');
$conn = sqlsrv_connect($serverName, $connectionInfo);
if($conn) {
echo "Connection establish.<br />";
}else {
echo "Connection could not be established.<br />";
die(print_r(sqlsrv_errors(), true));
}
?>
그러나 나는 다음과 같은 오류 얻을 :
Connection could not be established. 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 "xikwambene" requested by the login. The login failed. [message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "xikwambene" 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 "xikwambene" requested by the login. The login failed. [message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "xikwambene" requested by the login. The login failed.))
이 오류는 연결 세부 사항 실패 로그인에 의한 설립 할 수 없음을 보여줍니다. 내 코드에 로그인 세부 정보를 추가해야하는 경우 어떻게해야합니까? 도와주세요
팁 : 오류 메시지를 일반적으로 HTML이 포함되어 있지 않습니다. 브라우저의 "소스보기"메뉴에서 공백을 읽으면 공백이 보이지 않습니다. –
'NT AUTHORITY \ SYSTEM'은 Windows 서비스의 익명 계정입니다. 정말로 SQL Server에 액세스해야합니까? –