freetds连接问题macOS

时间:2017-07-19 21:58:51

标签: sql-server macos freetds

我正在尝试从MacOS连接到远程MSSQL数据库。

我可以使用freetds连接到远程数据库

tsql -H servername.database.windows.net -U username -P password -D database_name -p 1433

但是当我在/usr/local/etc/freetds.conf文件中使用以下设置进行输入时

[dbservername]
    host = servername.database.windows.net
    port = 1433
    database = database_name
    tds version = 7.3

尝试使用

进行连接
tsql -S dbservername -U username -P password

我收到以下错误

locale is "C/UTF-8/C/C/C/C"
locale charset is "UTF-8"
using default charset "UTF-8"
 2Msg 40532 (severity 20, state 1) from dbservername:
    "Cannot open server "dbservername" requested by the login.  The login failed."
Error 20002 (severity 9):
    Adaptive Server connection failed
There was a problem connecting to the server

tsql -C输出

Compile-time settings (established with the "configure" script)
                        Version: freetds v1.00.48
         freetds.conf directory: /usr/local/Cellar/freetds/1.00.48/etc
 MS db-lib source compatibility: no
    Sybase binary compatibility: no
                  Thread safety: yes
                  iconv library: yes
                    TDS version: 7.3
                          iODBC: no
                       unixodbc: no
          SSPI "trusted" logins: no
                       Kerberos: no
                        OpenSSL: yes
                         GnuTLS: no
                           MARS: no

知道如何解决这个问题吗?

2 个答案:

答案 0 :(得分:0)

问题是FreeTDS正在寻找不同目录中的配置文件。 tsql -C表示期望该文件位于/usr/local/Cellar/freetds/1.00.48/etc

freetds.conf/usr/local/etc/移至/usr/local/Cellar/freetds/1.00.48/etc,然后再试一次。祝你好运!

答案 1 :(得分:0)

回答得有点晚,但是必须将用户名写为:

username@servername

连接到Azure数据库(Azure中的sqlserver)时