无法通过Ubuntu上的TSQL连接到MSSQL

时间:2016-02-11 17:36:18

标签: sql-server ubuntu

我正在使用tsql来确认与ms sql server实例的连接:

tsql -S "66.239.210.201\[instance name],1481" -U [username]
Password: [password]

输出:

locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
[counts from 1 to 16]
16There was a problem connecting to the server

记录freetds.log

> log.c:196:Starting log file for FreeTDS 0.91
>         on 2016-02-11 14:01:46 with debug flags 0x4fff.
> iconv.c:330:tds_iconv_open(0x1eaea3b0, UTF-8)
> iconv.c:187:local name for ISO-8859-1 is ISO-8859-1
> iconv.c:187:local name for UTF-8 is UTF-8
> iconv.c:187:local name for UCS-2LE is UCS-2LE
> iconv.c:187:local name for UCS-2BE is UCS-2BE
> iconv.c:349:setting up conversions for client charset "UTF-8"
> iconv.c:351:preparing iconv for "UTF-8" <-> "UCS-2LE" conversion
> iconv.c:391:preparing iconv for "ISO-8859-1" <-> "ISO-8859-1" conversion
> iconv.c:394:tds_iconv_open: done
> net.c:934:tds7_get_instance_port(66.239.210.201, [redacted], 1481)
> net.c:985:tds7_get_instance_port: timed out on try 0 of 16
....
> net.c:985:tds7_get_instance_port: timed out on try 15 of 16
> net.c:1057:instance port is 0
> login.c:436:invalid port number
> mem.c:615:tds_free_all_results()

知道我做错了什么吗?我尝试使用-p标志指定不同的端口,但总是得到相同的消息。我也尝试在freetds.log中输入一个条目:

[sqlserver]
host = 66.239.210.201
instance = MSSQLSERVER
tds version = auto

并将其与tsql -S sqlserver一起使用,这会产生与上述相同的错误文件。

感谢您的时间。

1 个答案:

答案 0 :(得分:0)

你的日志说

  
    

net.c:934:tds7_get_instance_port(66.239.210.201,[编辑],1481)     net.c:985:tds7_get_instance_port:在尝试0的16时超时     ....     net.c:985:tds7_get_instance_port:在尝试15的16中超时     net.c:1057:实例端口为0

  

这意味着您的应用程序无法访问主机和端口对。可能有各种原因,如防火墙。或访问SQL服务器端提到的规则。

作为第一步,您可以尝试远程登录到主机和端口对以检查它是否可访问