我试图从64位Linux机器(ubuntu)连接到网络SQL服务器。我想我已正确配置了我的freetds.conf,odbc.ini和odbcinst.ini。但tsql给我一个连接错误。
我已尝试按照此链接的说明操作:
http://www.tryolabs.com/Blog/2012/06/25/connecting-sql-server-database-python-under-ubuntu/
然而,命令&ts; tsql -H {SQL Server IP地址} -p 1433 -U {用户名} -P {密码}'给出以下输出:
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Msg 18456 (severity 14, state 1) from <Sql Server Name> Line 1:
"Login failed for user '<username>'."
Error 20002 (severity 9):
Adaptive Server connection failed
There was a problem connecting to the server
To&#39; /usr/local/freetds/etc/freetds.conf'文件,我已添加:
[sqlserver]
host = {SQL Server IP Address}
port = 1433
tds version = 8.0
&#39; /etc/odbc.ini'文件包含:
[sqlserver]
Driver = freetds
Description = MSSQL Server
ServerName = {SQL Server IP Address}
Port = 1433
Trace = No
Database =
TDS_Version = 8.0
&#39; /etc/odbcinst.ini'文件包含:
[freetds]
Description = MS SQL database access with Free TDS
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
UsageCount = 1
FileUsage = 1
更多细节:如果我使用Windows,MS-SQL Server使用我的Windows凭据来访问服务器。它也是一个值得信赖的连接&#39; (不确定这意味着什么)。
我已经做了大量的搜索,并尝试过一份&#39; .freetds.conf&#39;在主目录中也没有运气。
答案 0 :(得分:1)
可信连接意味着它通过Active Directory用户进行身份验证。如果您在此处使用Active Directory用户,则要求SQL Server对SQL Server本地登录进行身份验证,并且您的用户是AD用户。我已成功为AD用户使用以下连接字符串:
'DRIVER={FreeTDS};SERVER=servername;PORT=1433;UID=domain\\username;PWD=********;TDS_Version=8.0;Trusted_domain=Your.Domain.com;'