PHP MS SQL Server数据库连接不工作
我正在尝试连接我的sql server 2012数据库,但它在我的php页面中显示错误PHP MS SQL Server数据库连接不工作,php,sql-server,iis-7,Php,Sql Server,Iis 7,我正在尝试连接我的sql server 2012数据库,但它在我的php页面中显示错误 Connection could not be established. Array ( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1] => -47 [code] => -47 [2] => An error occurred translating the connection string to UTF-1
Connection could not be established.
Array ( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1]
=> -47 [code] => -47 [2] => An error occurred
translating the connection string to UTF-16: No
mapping for the Unicode character exists in the
target multi-byte code page. [message] => An
error occurred translating the connection string to
UTF-16: No mapping for the Unicode character exists in the target multi-byte code page. ) )
我正在使用这个代码
<?php
$connectionInfo = array("UID" => "uid", "PWD" => "pass", "Database"=>"db");
$serverName = "(50.97.219.194\25000)";
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn )
{
echo "Connection established.\n";
}
else
{
echo "Connection could not be established.\n";
die( print_r( sqlsrv_errors(), true));
}
sqlsrv_close( $conn);
?>
我无法理解我的代码中有什么错误能否输出SQL错误。Die实际上没有给出太多细节。它只是表明您无法连接,$conn=mssql\u connect($serverName,$user,$pass)怎么样?