通过SQL Server Management Studio成功连接到数据库。 但是使用pymssql连接失败:
pymssql错误:
pymssql.OperationalError:(17892,“由于触发器执行登录失败,登录'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:
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
更多freetds.log
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')
tsql -H
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”,使用默认字符集“UTF-8”消息18456(严重级别14,状态1)来自xxxx \\ xxxxx第1行:“用户登录失败'xxxx'。
我该怎么做才能解决这个问题?