加入收藏 | 设为首页 | 会员中心 | 我要投稿 温州站长网 (https://www.0577zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

sql-server – 使用FreeTDS连接到MS SQL Server:错误20002:“A

发布时间:2020-12-25 13:15:08 所属栏目:MsSql教程 来源:网络整理
导读:我正在尝试使用FreeTDS从 Linux服务器(RHEL v7)连接到运行MS SQL Server 2014的单独服务器.但是,当尝试使用tsql连接时,我收到以下错误(错误消息因我是否包含用户名而异密码): $tsql -S MYSERVERlocale is "en_US.UTF-8"locale charset is "UTF-8"using de

我正在尝试使用FreeTDS从 Linux服务器(RHEL v7)连接到运行MS SQL Server 2014的单独服务器.但是,当尝试使用tsql连接时,我收到以下错误(错误消息因我是否包含用户名而异密码):

$tsql -S MYSERVER
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20002 (severity 9):
        Adaptive Server connection failed
There was a problem connecting to the server
$tsql -S MYSERVER -U myusername -P mypassword
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20017 (severity 9):
        Unexpected EOF from the server
Error 20002 (severity 9):
        Adaptive Server connection failed
There was a problem connecting to the server

另外,运行tsql -LH不会输出:

$tsql -LH MYSERVER
$

我不相信问题出在防火墙或SQL Server端的任何其他问题上,因为:

>我能够telnet到服务器:

$telnet my.server.address 1433
Trying 11.22.33.444...
Connected to my.server.address.

>并且,我可以通过ODBC数据源管理器实用程序从(Windows)笔记本电脑通过ODBC成功连接到SQL Server.

我的/etc/freetds.conf的内容:

[global]
  tds version = 7.0
; tds version = 4.2
...
[MYSERVER]
  host = my.server.address
  port = 1433
  tds version = 7.0

运行tsql -S MYSERVER后TDSDUMP日志文件的内容:

log.c:167:Starting log file for FreeTDS 0.95.19
  on 2015-11-18 10:02:20 with debug flags 0x4fff.
iconv.c:328:tds_iconv_open(0x1c53d90,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:346:setting up conversions for client charset "UTF-8"
iconv.c:348:preparing iconv for "UTF-8" <-> "UCS-2LE" conversion
iconv.c:395:preparing iconv for "ISO-8859-1" <-> "UCS-2LE" conversion
iconv.c:400:tds_iconv_open: done
net.c:202:Connecting to 11.22.33.444 port 1433 (TDS version 7.0)
net.c:274:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:313:tds_open_socket() succeeded
util.c:165:Changed query state from DEAD to IDLE
login.c:797:using GSS authentication
gssapi.c:218:using kerberos name MSSQLSvc/my.server.address:1433
gssapi.c:230:gss_import_name: GSS_S_COMPLETE: gss_import_name completed successfully.
gssapi.c:318:gss_init_sec_context: actual mechanism at 0x(nil)
gssapi.c:334:gss_init_sec_context: min_stat 2529639136 "Unknown error -1765328160"
gssapi.c:374:gss_init_sec_context: GSS_S_FAILURE: The routine failed for reasons that are not defined at the GSS level.
login.c:472:login packet rejected
query.c:3769:tds_disconnect()
util.c:165:Changed query state from IDLE to DEAD
util.c:322:tdserror(0x1c53ca0,0x1c53d90,20002,0)
util.c:352:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:375:tdserror: returning TDS_INT_CANCEL(2)
mem.c:648:tds_free_all_results()

解决方法

只需从密码中删除特殊字符,然后再试一次,我遇到了同样的问题并解决了这个问题

(编辑:温州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读