[英]sqlsrv connection string not valid [87]
Set up: 设定:
Already completed: 已经完成:
Additionally, I did have trouble with SQL Reporting Service taking port 80. This was giving me a problem with Apache, so I directed SQL Reporting Service to use port 8081. 此外,使用端口80的SQL Reporting Service确实遇到了麻烦。这给我带来了Apache的问题,因此我指示SQL Reporting Service使用端口8081。
<?php
$server = "computer_name\MSSQLSERVER";
$user = "sa";
$pass = "password";
$db = "pcm";
$connInfo = array("Database"=>$db, "UID"=>$user, "PWD"=>$pass);
$conn = sqlsrv_connect($server, $connInfo) or die( print_r( sqlsrv_errors(), true));
?>
If you are using the PDO extension, you will have to use a PDO connection instead of the sqlsrv_connect()
function. 如果使用的是PDO扩展名,则必须使用PDO连接而不是
sqlsrv_connect()
函数。 Microsoft doesn't support the UID
or PWD
keys that you are providing when trying to connect via the PDO extension. 当尝试通过PDO扩展名进行连接时,Microsoft不支持您提供的
UID
或PWD
密钥。 Try this instead: 尝试以下方法:
$conn = new PDO('sqlsrv:Server = ' . $server . '; Database = ' . $db, $user, $pass);
http://php.net/manual/en/ref.pdo-sqlsrv.connection.php http://php.net/manual/en/ref.pdo-sqlsrv.connection.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.