2

I am unable to connect to a MSSQL 2012 Server using FreeTDS on OSX in the terminal when I pass the -P .

Example:

V-MBP:etc vashavoc$ tsql -S SERVER_IP -p PORT -U USER -P PASSWORD
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Msg 18456 (severity 14, state 1) from SERVER_IP Line 1:
"Login failed for user 'USER'."
Error 20002 (severity 9):
Adaptive Server connection failed
There was a problem connecting to the server

If I leave out the -P and force it to prompt for input, I can type/paste it in and I can connect. (No there is no typo when I try using -P.)

V-MBP:etc vashavoc$ tsql -S SERVER_IP -p PORT -U USER
Password: 
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
1> 

Seems very odd it works when I omit the password from the connect string. FreeTDS seems installed OK.

V-MBP:sh vashavoc$ tsql -C
Compile-time settings (established with the "configure" script)
                        Version: freetds v0.95.80
         freetds.conf directory: /usr/local/Cellar/freetds/0.95.80/etc
 MS db-lib source compatibility: no
    Sybase binary compatibility: no
                  Thread safety: yes
                  iconv library: yes
                    TDS version: 7.1
                          iODBC: no
                       unixodbc: no
          SSPI "trusted" logins: no
                       Kerberos: no
                        OpenSSL: yes
                         GnuTLS: no

Tried TDSVER=X.X variants before the tsql string without any change.

tsql -LH SERVER_IP

Also tried to see if it would list back its instances using the -LH, doesn't respond and times out I presume.

Am I missing anything that could get this to work? It is a server setting that is preventing it?

  • 3
    Are there any special characters in your password that'll get mangled by the shell? ($,% etc) – Philᵀᴹ May 19 '16 at 7:34
  • Thank you Phil, wrapped that char in \$\ made it work. 👍 – vashavoc May 19 '16 at 23:22
1

@Phil's suggesting of the special char causing an issue was the problem. Corrected and the connection string works fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.