Search code examples
sql-servert-sqlfreetds

FreeTDS hangs indefinitely after Microsoft SQL Express 2012 Install


FreeTDS hangs indefinitely when I try to connect to a server:

C:\FreeTDS\bin>tsql -H localhost -p 1433
locale is "English_United States.1252"
locale charset is "CP1252"
using default charset "CP1252"

(nothing else is displayed, can only exit with ^C)

Identical behaviour occurs when I run tsql -S <servername>.

I recently uninstalled Microsoft SQL Server Management Studio, and then installed the Express edition. Connection with tsql -H localhost -p 1433 worked before the uninstall/install.

Running tsql -C yields:

Compile-time settings (established with the "configure" script)
                        Version: freetds v0.91.98
         freetds.conf directory: /mingw/etc
 MS db-lib source compatibility: no
    Sybase binary compatibility: no
                  Thread safety: yes
                  iconv library: yes
                    TDS version: 7.0
                          iODBC: no
                       unixodbc: yes
          SSPI "trusted" logins: yes
                       Kerberos: yes (Heimdal 1.5.3)
                 SSL encryption: yes (OpenSSL 1.0.1e)

Some more information:

I have the folowing SQL-related services running:

  • SQL Full-Text Filter Daemon Launcher (SQLEXPRESS)
  • SQL Server (SQLEXPRESS)
  • SQL Server Browser
  • SQL Server Reporting Services (SQLEXPRESS)
  • SQL Server VSS Writer

I have tried reinstalling FreeTDS.

I have enabled TCP/IP for SQLEXPRESS in the Sql Server Configuration Manager.


Solution

  • The tsql command was hanging because the server was not running on the default port. I found this out by running C:\>netstat -na | find "1433", which showed nothing LISTENING on port 1433.

    This is how I fixed the problem:

    1. Open "Sql Server Configuration Manager"
    2. Go to "SQL Server Network Configuration > Protocols for SERVER"
    3. Right click "TCP/IP", select "Properties", go to the "IP Addresses" tab
    4. Under "IPAll" set "TCP Port" to the desired port number
    5. Click OK, and restart the SQL Server service.

    TCP Port was previously blank, setting it to a valid port solved the problem.