freetds connection issue macOS

Viewed 610

I am trying to connect to a remote MSSQL DB from a MacOS.

I am able to connect to the remote DB using freetds

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

But as I make an entry in the /usr/local/etc/freetds.conf file with following settings

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

And try to connect using

tsql -S dbservername -U username -P password

I get the following error

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 output

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

Any idea how to fix that?

2 Answers

A little late to answer, but it's required to write the username as:

username@servername

when connected to Azure Database (sqlserver in Azure)

Related