Question

I'm trying to connect to a MSSQL 2005 server using FreeTDS.

But I'm getting the "Login failed for user" error. There is a section on it in the FreeTDS manual trouble shooting section. But it does not mention any possible errors related to it. Can it be an issue with my tsql connection string? Or is it something misconfigured on the MSSQL side?

I am able to connect to the SQL Server Management using the same credentials.

This is what I am using and the output (I've removed the ipnumber and username):

$ TDSVER=4.2 tsql -H <ipnumber> -p 1433 -U <username>
Password:
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Msg 18456 (severity 14, state 1) from PS136 Line 1:
        "Login failed for user '<username>'."
Error 20002 (severity 9):
        Adaptive Server connection failed
There was a problem connecting to the server

And my compile time settings:

$ tsql -C
Compile-time settings (established with the "configure" script)
                            Version: freetds v0.91
             freetds.conf directory: /etc/freetds
     MS db-lib source compatibility: no
        Sybase binary compatibility: yes
                      Thread safety: yes
                      iconv library: yes
                        TDS version: 4.2
                              iODBC: no
                           unixodbc: yes
              SSPI "trusted" logins: no
                           Kerberos: no

I'm on Ubuntu 12.04 and I installed FreeTDS like so:

 $sudo apt-get install freetds-common freetds-bin tdsodbc
Was it helpful?

Solution

Turned out I had been given the wrong port number. I also needed to specify the instance in the freetds config file.

OTHER TIPS

I also use freetds to connect to SQL Server 2012.

I have this section in my freetds.conf file

[mycomp]
        host = some.ipnumber.or.hostname
        port = 1433
        client charset = UTF-8
        tds version = 8.0

Then I connect with sqsh (isql replacement, also in the ubuntu repos)

 sqsh -I /etc/freetds/freetds.conf -Smycomp  -Uknb -Psecrit

This is my tsql -C output

○ → tsql -C
Compile-time settings (established with the "configure" script)
                            Version: freetds v0.91
             freetds.conf directory: /etc/freetds
     MS db-lib source compatibility: no
        Sybase binary compatibility: yes
                      Thread safety: yes
                      iconv library: yes
                        TDS version: 4.2
                              iODBC: no
                           unixodbc: yes
              SSPI "trusted" logins: no
                           Kerberos: yes
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top