我正在使用pymssql连接到sql server 2012(SP4)。我收到错误消息-Adaptive Server连接失败
pymssql版本-2.1.4 python-3.6
我试图从REPL连接到SQL Server。请找到详细信息-
pymssql.connect(server=r'sql.domain.com\DEV',port=1433,user='user',password='password',database='SCDINSD',tds_version="7.3")
下面是tds转储
dblib.c:720:dblogin(void)
dblib.c:775:dbsetlname(0386EC18, user, 2)
dblib.c:775:dbsetlname(0386EC18, password, 3)
dblib.c:775:dbsetlname(0386EC18, pymssql=2.1.4, 5)
dblib.c:945:dbsetlversion(0386EC18, 7)
dblib.c:775:dbsetlname(0386EC18, UTF-8, 10)
dblib.c:775:dbsetlname(0386EC18, SCDINSD, 14)
dblib.c:4231:dbsetlogintime(60)
dblib.c:1180:tdsdbopen(0386EC18, sql.domain.com\DEV, [microsoft])
dblib.c:1206:tdsdbopen: dbproc->dbopts = 027FE900
dblib.c:1217:tdsdbopen: tds_set_server(02C86B70, "sql.domain.com\DEV")
dblib.c:257:dblib_get_tds_ctx(void)
dblib.c:1234:tdsdbopen: About to call tds_read_config_info...
config.c:169:Getting connection information for [sql.domain.com\DEV].
config.c:173:Attempting to read conf files.
config.c:359:... $FREETDSCONF not set. Trying $FREETDS/etc.
config.c:372:... $FREETDS not set. Trying $HOME.
config.c:302:Found conf file 'C:\Users\user\AppData\Roaming/.freetds.conf' (.freetds.conf).
config.c:510:Looking for section global.
config.c:569: Found section global.
config.c:572:Got a match.
config.c:595: tds version = '7.3'
config.c:932:Setting tds version to 7.3 (0x703).
config.c:583: Reached EOF
config.c:510:Looking for section sql.domain.com\DEV.
config.c:569: Found section global.
config.c:583: Reached EOF
config.c:308:[sql.domain.com\DEV] not found.
config.c:298:Could not open 'c:\freetds.conf' ((default)).
config.c:359:... $FREETDSCONF not set. Trying $FREETDS/etc.
config.c:372:... $FREETDS not set. Trying $HOME.
config.c:302:Found conf file 'C:\Users\user\AppData\Roaming/.freetds.conf' (.freetds.conf).
config.c:510:Looking for section global.
config.c:569: Found section global.
config.c:572:Got a match.
config.c:595: tds version = '7.3'
config.c:932:Setting tds version to 7.3 (0x703).
config.c:583: Reached EOF
config.c:510:Looking for section sql.domain.com.
config.c:569: Found section global.
config.c:583: Reached EOF
config.c:308:[sql.domain.com] not found.
config.c:298:Could not open 'c:\freetds.conf' ((default)).
config.c:810:Setting 'dump_file' to 'stdout' from $TDSDUMP.
config.c:714:tds_config_login: client_charset is UTF-8.
config.c:721:tds_config_login: database_name is SCDINSD.
config.c:214:Final connection parameters:
config.c:215: server_name = sql.domain.com\DEV
config.c:216: server_host_name = sql.domain.com
config.c:219: ip_addr = 10.12.68.170
config.c:224: instance_name = DEV
config.c:225: port = 0
config.c:226: major_version = 7
config.c:227: minor_version = 3
config.c:228: block_size = 0
config.c:229: language = us_english
config.c:230: server_charset =
config.c:231: connect_timeout = 0
config.c:232: client_host_name = JNJW7PF0UBWHQ
config.c:233: client_charset = UTF-8
config.c:234: use_utf16 = 1
config.c:235: app_name = pymssql=2.1.4
config.c:236: user_name = user
config.c:239: library = DB-Library
config.c:240: bulk_copy = 1
config.c:241: suppress_language = 0
config.c:242: encrypt level = 0
config.c:243: query_timeout = 0
config.c:246: database = SCDINSD
config.c:247: dump_file = stdout
config.c:248: debug_flags = 0
config.c:249: text_size = 0
config.c:250: emul_little_endian = 0
config.c:251: server_realm_name =
config.c:252: server_spn =
config.c:253: cafile =
config.c:254: crlfile =
config.c:255: check_ssl_hostname = 1
config.c:256: db_filename =
config.c:257: readonly_intent = 0
log.c:168:Starting log file for FreeTDS 1.1.dev.20180827
on 2019-01-31 13:41:50 with debug flags 0x4fff.
config.c:810:Setting 'dump_file' to 'stdout' from $TDSDUMP.
dblib.c:1261:tdsdbopen: Calling tds_connect_and_login(028993C0, 02B8CF08)
iconv.c:325:tds_iconv_open(02C03AE0, UTF-8)
iconv.c:347:setting up conversions for client charset "UTF-8"
iconv.c:349:preparing iconv for "UTF-8" <-> "UCS-2LE" conversion
iconv.c:388:tds_iconv_open: done
net.c:1241:tds7_get_instance_port(10.12.68.170, DEV)
net.c:1316:instance info
0000 05 58 00 53 65 72 76 65-72 4e 61 6d 65 3b 55 53 |.X.Serve rName;US|
0010 43 4c 41 53 51 4c 56 53-32 30 30 32 3b 49 6e 73 |CLASQLVS 2002;Ins|
0020 74 61 6e 63 65 4e 61 6d-65 3b 44 45 56 3b 49 73 |tanceNam e;DEV;Is|
0030 43 6c 75 73 74 65 72 65-64 3b 4e 6f 3b 56 65 72 |Clustere d;No;Ver|
0040 73 69 6f 6e 3b 31 31 2e-30 2e 37 30 30 31 2e 30 |sion;11. 0.7001.0|
0050 3b 74 63 70 3b 31 34 33-33 3b 3b |;tcp;143 3;;|
net.c:1357:instance port is 1433
net.c:391:Connecting with protocol version 7.3
net.c:318:Connecting to 10.12.68.170 port 1433
net.c:340:tds_setup_socket: connect(2) returned "A non-blocking socket operation could not be completed immediately.
"
net.c:528:tds_open_socket() succeeded
packet.c:801:Sending packet
0000 12 01 00 32 00 00 00 00-00 00 1a 00 06 01 00 20 |...2.... ....... |
0010 00 01 02 00 21 00 04 03-00 25 00 04 04 00 29 00 |....!... .%....).|
0020 01 ff 09 00 00 00 00 00-02 44 45 56 00 80 3c 00 |........ .DEV..<.|
0030 00 00 - |..|
packet.c:435:Received packet
0000 04 01 00 2b 00 00 01 00-00 00 1a 00 06 01 00 20 |...+.... ....... |
0010 00 01 02 00 21 00 01 03-00 22 00 00 04 00 22 00 |....!... ."....".|
0020 01 ff 0b 00 1b 59 00 00-02 00 00 |.....Y.. ...|
login.c:1237:detected flag 2
login.c:960:quietly sending TDS 7+ login packet
token.c:305:tds_process_login_tokens()
Traceback (most recent call last):
File "src\pymssql.pyx", line 636, in pymssql.connect
File "src\_mssql.pyx", line 1957, in _mssql.connect
File "src\_mssql.pyx", line 676, in _mssql.MSSQLConnection.__init__
File "src\_mssql.pyx", line 1683, in _mssql.maybe_raise_MSSQLDatabaseException
_mssql.MSSQLDatabaseException: (18456, b'DB-Lib error message 20018, severity 14:\nGeneral SQL Server error: Check messages from the SQL Server\nDB-Lib error message 20002, severity 9:\nAdaptive Server connection failed (sql.domain.com\\DEV)\n')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\IPython\core\interactiveshell.py", line 2910, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-20-b2ea12ac01d3>", line 1, in <module>
pymssql.connect(server=r'sql.domain.com\DEV',port=1433,user='user',password='Helloworld@16',database='SCDINSD',tds_version="7.3")
File "src\pymssql.pyx", line 642, in pymssql.connect
pymssql.OperationalError: (18456, b'DB-Lib error message 20018, severity 14:\nGeneral SQL Server error: Check messages from the SQL Server\nDB-Lib error message 20002, severity 9:\nAdaptive Server connection failed (sql.domain.com\\DEV)\n')
packet.c:435:Received packet
0000 04 01 00 88 00 5c 01 00-aa 70 00 18 48 00 00 01 |.....\.. .p..H...|
0010 0e 1f 00 4c 00 6f 00 67-00 69 00 6e 00 20 00 66 |...L.o.g .i.n. .f|
0020 00 61 00 69 00 6c 00 65-00 64 00 20 00 66 00 6f |.a.i.l.e .d. .f.o|
0030 00 72 00 20 00 75 00 73-00 65 00 72 00 20 00 27 |.r. .u.s .e.r. .'|
0040 00 74 00 39 00 73 00 61-00 75 00 32 00 27 00 2e |.t.9.s.a .u.2.'..|
0050 00 12 55 00 53 00 43 00-4c 00 41 00 53 00 51 00 |..U.S.C. L.A.S.Q.|
0060 4c 00 56 00 53 00 32 00-30 00 30 00 32 00 5c 00 |L.V.S.2. 0.0.2.\.|
0070 44 00 45 00 56 00 00 01-00 00 00 fd 02 00 00 00 |D.E.V... ........|
0080 00 00 00 00 00 00 00 00- |........|
token.c:313:looking for login token, got aa(ERROR)
token.c:132:tds_process_default_tokens() marker is aa(ERROR)
mem.c:656:tds_free_all_results()
token.c:2389:tds_process_info() reading message 18456 from server
token.c:2461:tds_process_info() calling client msg handler
dbutil.c:75:_dblib_handle_info_message(02AC06F8, 028993C0, 0047EB4C)
dbutil.c:76:msgno 18456: "Login failed for user 'user'."
token.c:2478:tds_process_info() returning TDS_SUCCESS
token.c:313:looking for login token, got fd(DONE)
token.c:132:tds_process_default_tokens() marker is fd(DONE)
token.c:2087:tds_process_end: more_results = 0
was_cancelled = 0
error = 1
done_count_valid = 0
token.c:2106: rows_affected = 0
token.c:2109:tds_process_end() state set to TDS_IDLE
token.c:422:tds_process_login_tokens() returning TDS_FAIL
login.c:537:login packet accepted
query.c:3773:tds_disconnect()
util.c:165:Changed query state from IDLE to DEAD
util.c:319:tdserror(02AC06F8, 028993C0, 20002, 0)
dblib.c:8115:dbperror(036F6018, 20002, 0)
dblib.c:8183:dbperror: Calling dblib_err_handler with msgno = 20002; msg->msgtext = "Adaptive Server connection failed (sql.domain.com\DEV)"
dblib.c:8205:dbperror: dblib_err_handler for msgno = 20002; msg->msgtext = "Adaptive Server connection failed (sql.domain.com\DEV)" -- returns 2 (INT_CANCEL)
util.c:349:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:372:tdserror: returning TDS_INT_CANCEL(2)
dblib.c:1265:tdsdbopen: tds_connect_and_login failed for "sql.domain.com\DEV"!
dblib.c:1478:dbclose(036F6018)
dblib.c:242:dblib_del_connection(0F4F1ED8, 028993C0)
mem.c:656:tds_free_all_results()
dblib.c:289:dblib_release_tds_ctx(1)
dblib.c:6051:dbfreebuf(036F6018)
dblib.c:750:dbloginfree(0386EC18)