[Solved] tsql error Adaptive Server connection failed

[Solved] tsql error Adaptive Server connection failed


Preliminars :)

Install tsql: http://guywyant.info/log/206/connecting-to-ms-sql-server-from-ubuntu/
Troubleshooting: http://www.freetds.org/userguide/confirminstall.htm

step 1

check port 1433 is open on target database
PORT     STATE SERVICE  VERSION
1433/tcp open  ms-sql-s Microsoft SQL Server 2008 R2 10.50.4305.00; SP2+

Host script results:
| ms-sql-info:
|   Windows server name: US1S-URFREFD01X
|   [\MSSQLSERVER]
|     Instance name: MSSQLSERVER
|     Version: Microsoft SQL Server 2008 R2 SP2+
|       Version number: 10.50.4305.00
|       Product: Microsoft SQL Server 2008 R2
|       Service pack level: SP2
|       Post-SP patches applied: Yes
|     TCP port: 1433
|     Named pipe: \\\pipe\sql\query
|_    Clustered: Yes



Step 2

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

Step3

Make sure your file is like the following (the value of instance is taken from nmap -v -A -p1433 target) :
[MSSQL]
        host = US1S-URFREFD01X.AAAC.US1.REUPPINT.COM
        instance = MSSQLSERVER
        tds version = 7.0
        #tcp =   required only if port is not default (i.e. port other than 1433)
        charset = UTF-8

Step 3
Make sure the .so file actually exists
# cat /etc/odbcinst.ini
[FreeTDS]
Description = FreeTDS
Driver = /usr/local/lib/libtdsodbc.so

Step 4
# cat /etc/odbc.ini [MSSQL]
Description = MSSQL
Driver = FreeTDS
Server =
Port = 1433


Step 5 - connect
tsql -S MSSQL  -U admin -P Password1