Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/315.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何修复';20002,严重性9:自适应服务器连接失败';pymssql中的错误_Python_Sql Server 2014_Pymssql_Suse - Fatal编程技术网

Python 如何修复';20002,严重性9:自适应服务器连接失败';pymssql中的错误

Python 如何修复';20002,严重性9:自适应服务器连接失败';pymssql中的错误,python,sql-server-2014,pymssql,suse,Python,Sql Server 2014,Pymssql,Suse,通过SQL Server Management Studio成功连接到数据库。但是使用pymssql连接失败: pymssql错误: pymssql.OperationalError:(17892,“由于触发exe执行,登录'xxx'失败。DB-Lib错误消息20018,严重性14:\n一般SQL Server错误:检查SQL Server \nDB Lib错误消息20002的错误,严重性9:\n适配器服务器连接失败(xxxx\xxxx)\n”) 版本信息: SQL Server版本为2014

通过SQL Server Management Studio成功连接到数据库。但是使用
pymssql
连接失败:

pymssql错误: pymssql.OperationalError:(17892,“由于触发exe执行,登录'xxx'失败。DB-Lib错误消息20018,严重性14:\n一般SQL Server错误:检查SQL Server \nDB Lib错误消息20002的错误,严重性9:\n适配器服务器连接失败(xxxx\xxxx)\n”)

版本信息: SQL Server版本为2014 12.0.6024.0

Linux服务器操作系统是SUSE Linux Enterprise server 12(x86_64)

pymssql版本:
pymssql-2.1.4

./tsql-C: 更多freetds.log tsql-H LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_时间=C;LC_COLLATE=C;LC_MONETARY=C;LC_=C;LC_PAPER=C;LC_NAME=C;LC_地址=C;LC_电话=C;LC_测量=C;LC_IDENTIFICATION=C“locale字符集为“UTF-8”,使用xxxx\xxxxx第1行中的默认字符集“UTF-8”Msg 18456(严重级别14,状态1):“用户“xxxx”登录失败”


我应该怎么做才能解决这个问题?

您可以使用
tsql-hx.x.x-p1433-U您的\U用户名-p您的\U密码进行连接吗?(x.x.x.x由实际IP地址替换)?如果没有,freetds.log是否仍然显示“由于触发执行,登录'xxxx'登录失败”消息?错误消息是:区域设置是“LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C”区域设置字符集是“UTF-8”使用xxxx\xxxxx第1行中的默认字符集“UTF-8”Msg 18456(严重级别14,状态1):“用户“xxxx”登录失败”。错误20002(严重级别9):自适应服务器连接失败连接到服务器时出现问题“由于触发执行,登录“xxxx”登录失败”表明问题特定于该SQL Server登录。您可以使用这些相同的凭据从SSM连接吗?如果是这样,登录触发器可能会对SQL Server登录可以连接的机器施加一些限制(假设SSMS机器和pymssql/FreeTDS机器是不同的框)。
Compile-time settings (established with the "configure" script)
                            Version: freetds v1.00.9
             freetds.conf directory: /usr/local/freetds/etc
     MS db-lib source compatibility: yes
        Sybase binary compatibility: no
                      Thread safety: yes
                      iconv library: yes
                        TDS version: 7.1
                              iODBC: no
                           unixodbc: yes
              SSPI "trusted" logins: no
                           Kerberos: no
                            OpenSSL: yes
                             GnuTLS: no
                               MARS: no
util.c:375:tdserror: returning TDS_INT_CANCEL(2)
net.c:216:Connecting to x.x.x.x port 1433 (TDS version 4.2)
net.c:242:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:343:tds_open_socket() succeeded
packet.c:741:Sending packet
......
token.c:306:looking for login token, got  aa(ERROR)
token.c:125:tds_process_default_tokens() marker is aa(ERROR)
token.c:2328:tds_process_info() reading message 17892 from server
token.c:2403:Msg 17892, Severity 14, State 1, Server xxxxx\xxxxx, Line 1
Logon failed for login 'xxxx' due to trigger execution.
token.c:2417:tds_process_info() returning TDS_SUCCESS
token.c:306:looking for login token, got  fd(DONE)
token.c:125:tds_process_default_tokens() marker is fd(DONE)
token.c:2065:tds_process_end: more_results = 0
                was_cancelled = 0
                error = 1
                done_count_valid = 0
token.c:2082:                rows_affected = 0
token.c:2085:tds_process_end() state set to TDS_IDLE
token.c:415:tds_process_login_tokens() returning TDS_FAIL
login.c:530:login packet accepted
query.c:3796:tds_disconnect()
util.c:165:Changed query state from IDLE to DEAD
util.c:322:tdserror(0x7f676bb19200, 0x228d1c0, 20002, 0)
util.c:358:tdserror: client library not called because either tds_ctx (0x7f676bb19200) or tds_ctx->err_handler is NULL
util.c:375:tdserror: returning TDS_INT_CANCEL(2)
util.c:322:tdserror(0x1cca6f0, 0x228d1c0, 20002, 110)
dblib.c:7949:dbperror(0x22d8430, 20002, 110)
dblib.c:8017:dbperror: Calling dblib_err_handler with msgno = 20002; msg->msgtext = "Adaptive Server connection failed (xxxxx\xxxxx)"
dblib.c:8039:dbperror: dblib_err_handler for msgno = 20002; msg->msgtext = "Adaptive Server connection failed (xxxxx\xxxxx)" -- returns 2 (INT_CANCEL)
util.c:352:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:375:tdserror: returning TDS_INT_CANCEL(2)
dblib.c:1260:tdsdbopen: tds_connect_and_login failed for "xxxxx\xxxxx"!
dblib.c:1476:dbclose(0x22d8430)
dblib.c:241:dblib_del_connection(0x7f676bd29860, 0x228d1c0)
mem.c:644:tds_free_all_results()
dblib.c:288:dblib_release_tds_ctx(1)
dblib.c:5881:dbfreebuf(0x22d8430)
dblib.c:749:dbloginfree(0x21bce80)
Traceback (most recent call last):
  File "src/pymssql.pyx", line 642, in pymssql.connect
pymssql.OperationalError: (20002, 'DB-Lib error message 20002, severity 9:\nAdaptive Server connection failed (xxxxx\xxxxx)\nNet-Lib error during Connection timed out (110)\n')