tsql -S SQLEXPRESS -U sa
密码:sa
它会抛出错误
错误20009(严重级9):无法连接:Adaptive Server不可用或不存在操作系统错误111,“连接被拒绝”
我遵循的步骤 /etc/freetds/freetdsconf.conf
[SQLEXPRESS]
host = 192.168.1.9
port = 1433
tds version = 8.0
client charset = UTF-8
/etc/odbcinst.ini
[FreeTDS]
Description = TDS driver (Sybase/MS SQL)
Driver =/usr/lib/i386-linux-gnu/odbc/libtdsodbc.so
Setup =/usr/lib/i386-linux-gnu/odbc/libtdsS.so
CPTimeout =
CPReuse =
FileUsage = 1
etc/odbc.ini
[SQLEXPRESS]
Driver = FreeTDS
Description = ODBC connection via FreeTDS
Trace = No
Servername = 192.168.1.9
Database = cakephp_results
Port = 1433
UID = sa
PWD = sa
ReadOnly = No
答案 0 :(得分:1)
在你的odbc.ini文件中,将'Servername ='更改为'Server ='。然后暂时从该文件中删除UID,PWD和ReadOnly行。您可能希望完全删除它们并从您的应用程序传递凭据。
然后,确保您的MSSQL DB允许通过端口1433进行连接,SQL Server没有阻止传入服务器的IP地址,并且您拥有正确的密码。
此外,如果不起作用,请查看以下troubleshooting 说明: