无法在PHP和SQL Server(Unix)之间建立连接 [英] can't establish connection between PHP and SQL Server (Unix)
问题描述
我正在尝试在php和SQL Server之间建立连接.这是我正在使用的连接功能:
I'm trying to establish a connection between php and SQL Server. Here's the connection function I'm using :
$con = new PDO ("dblib:host=xxx.xxx.xxx.xxx:1433;dbname=xxxx", $dbuser, $dbpwd);
我收到以下消息:SQLSTATE [28000]登录不正确. (严重性9)
I get the following message : SQLSTATE[28000] Login incorrect. (severity 9)
安装freetds-devel之后,错误消失了,但是我得到了另一个错误: SQLSTATE [01002] Adaptive Server连接失败(严重性9)
After having installed freetds-devel, the error has gone but I got an other one : SQLSTATE[01002] Adaptive Server connection failed (severity 9)
NB: MSSQL不在UNIX系统上,而PHP在.
N.B.: MSSQL isn't on a UNIX system, but the PHP is.
解决方案::我将FreeTDS.conf(在[global]下)的TDS版本更改为7.0,它的工作原理就像一个魅力
SOLUTION: I changed the TDS version in the FreeTDS.conf (under [global]) to 7.0 and it worked like a charm
感谢您的帮助
推荐答案
您的用户名或密码可能不正确.
Your username or password are probably incorrect.
检查您是否具有从连接的IP地址登录的权限.
Check you have permissions to login from the IP address you're connecting from.
这篇关于无法在PHP和SQL Server(Unix)之间建立连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!