我尝试使用python连接Azure SQL,但得到下一个错误:
File "pymssql.pyx", line 641, in pymssql.connect (pymssql.c:10824)
pymssql.OperationalError: (20002, 'DB-Lib error message 20002, severity 9:\nAdaptive Server connection failed (myserver:1433)\n')freetds.conf:
[global]
# TDS protocol version
tds version = 7.4
# Whether to write a TDSDUMP file for diagnostic purposes
# (setting this to /tmp is insecure on a multi-user system)
dump file = /tmp/freetds.log
; debug flags = 0xffff
# Command and connection timeouts
; timeout = 10
; connect timeout = 10
# If you get out-of-memory errors, it may mean that your client
# is trying to allocate a huge buffer for a TEXT field.
# Try setting 'text size' to a more reasonable limit
text size = 64512如果我尝试连接,使用tsql -连接成功!
我尝试用params重新编译freetds:
./configure --enable-msdblib --enable-threadsafe --enable-sybase-compat --with-tdsver=7.4 --with-openssl=/usr/bin我用的是这个手册https://msdn.microsoft.com/en-us/library/mt694094(v=sql.1).aspx
发布于 2016-07-01 17:07:35
我从源pymssql和freetds解决了这个问题(在前面的文章中有选项,在全局配置中设置了tds version=7.3 )。Pymssql从源代码中使用命令"python setup.py build“,然后用于在系统中安装"python setup.py install”。
发布于 2016-06-29 02:38:16
@Alximik根据我的经验,我不认为有必要通过self重新编译freetds。对于这个问题,我认为问题是由您对freetds.conf的配置引起的,请参阅我对已解决线程pymssql: Connection to the database only works sometimes的答案和下面的示例配置内容。
host = <database_name>.database.windows.net
port = 1433
tds version = 7.3同时,您可以参考http://www.freetds.org/userguide/freetdsconf.htm来配置它。
https://stackoverflow.com/questions/38082124
复制相似问题