问题
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.
回答1:
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:
- Open "Sql Server Configuration Manager"
- Go to "SQL Server Network Configuration > Protocols for SERVER"
- Right click "TCP/IP", select "Properties", go to the "IP Addresses" tab
- Under "IPAll" set "TCP Port" to the desired port number
- Click OK, and restart the SQL Server service.

来源:https://stackoverflow.com/questions/29310336/freetds-hangs-indefinitely-after-microsoft-sql-express-2012-install