sql-server - 在 Ubuntu 上通过 TSQL 连接到 MSSQL 时遇到问题

标签 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 一起使用,这会产生与上述相同的错误文件。

感谢您的宝贵时间。

最佳答案

你的日志说

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

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

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

关于sql-server - 在 Ubuntu 上通过 TSQL 连接到 MSSQL 时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35346244/

相关文章:

json - 在 SSIS 中读取包含 JSON 列的 csv 文件?

gcc - 如何在 ubuntu 上安装新版本的 gcc

Git - 如何验证 Git 是否安装在 Ubuntu 上以及安装在何处

linux - 如何卸载从源代码安装的 gcc?

ubuntu - 无法从其他机器连接 cassandra 端口 9042。

sql-server - Microsoft SQL Server 2008 Management Studio 中的备用枚举数据类型是什么?

使用 coldfusion 的 jquery 可排序更新数据库

sql - 将列中的数据替换为 SQL 中的字符

sql - T-SQL 中的 EXEC 忽略 CONCAT_NULL_YIELDS_NULL

node.js - 在 Ubuntu 上更新 Node JS