我正在 Somee Server(somee.com) 和Microsoft SQL上使用 PHP 构建网站。现在我在 php 和 SQL 之间建立连接时遇到问题。
这是我的连接代码:
<?php
$serverName = "mssql.somee.com"; //serverName\instanceName
// Since UID and PWD are not specified in the $connectionInfo array,
// The connection will be attempted using Windows Authentication.
$connectionInfo = array( "Database"=>"myDB","UID"=>"myusername","PWD"=>"mypassword");
$conn = sqlsrv_connect( "mssql.somee.com", $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));} ?>
它返回给我这个错误:
无法建立连接。数组 ( [0] => 数组 ( [0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [代码] => 18456 [2] => [Microsoft][SQL Server Native Client 11.0][SQL服务器]用户“jason_SQLLogin”登录失败。[消息] => [Microsoft][SQL Server Native Client 11.0][SQL Server]用户“jason_SQLLogin”登录失败。)[1] => 数组([0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]用户'jason_SQLLogin'登录失败。[消息] = > [Microsoft][SQL Server Native Client 11.0][SQL Server]用户“jason_SQLLogin”登录失败。))
有人知道吗?非常感谢。真的很感激。