新增一些库对应的脚本,都是mssql,原有数据库链接正常,链接新的的时候报这个错;
File "pymssql.pyx", line 641, in pymssql.connect (pymssql.c:10788)
pymssql.OperationalError: (20017, 'DB-Lib error message 20017, severity 9:\nUnexpected EOF from the server\nNet-Lib error during No such file or directory (2)\nDB-Lib error message 20002, severity 9:\nAdaptive Server connection failed\n')
配置:
db_ro={"host":"xxx.com", "database":"xxdb", "user":"xx_ro", "password":"***", "port":1433, "charset":"utf8"}
按照网络上查询的结果:
1.更改charset,无效;
2.更改本地配置,无效;
经研究后,发现添加tds_version参数,并将pymssql版本提升至最新的2.1.3后可以正常链接;
db_ro={"host":"xxx.com", "database":"xxdb", "user":"xx_ro", "password":"***", "port":1433, "charset":"utf8","tds_version":"7.0"}
tds_version无法在2.1.1上正常运行.
2.1.3中pymssql.py新增 keyword tds_version:
:keyword tds_version: TDS protocol version to use.
:type tds_version: string