Python pymssql:Adaptive Server 连接失败
Python pymssql: Adaptive Server connection failed
我尝试使用 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 - 连接成功!
我尝试使用参数重新编译 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
@Alximik 根据我的经验,我认为没有必要自行重新编译 freetds。对于这个问题,我认为问题是由您对 freetds.conf
的配置引起的,请参阅我对已解决的 SO 线程 的回答和下面的示例配置内容。
host = <database_name>.database.windows.net
port = 1433
tds version = 7.3
同时,您可以参考http://www.freetds.org/userguide/freetdsconf.htm进行配置
我在从源代码 pymssql 和 freetds 生成后解决了它(使用先前 post 中的选项并在全局配置中设置 tds version=7.3)。
Pymssql make from source use command "python setup.py build" 然后下一步在系统中安装 "python setup.py install"
我尝试使用 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 - 连接成功!
我尝试使用参数重新编译 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
@Alximik 根据我的经验,我认为没有必要自行重新编译 freetds。对于这个问题,我认为问题是由您对 freetds.conf
的配置引起的,请参阅我对已解决的 SO 线程
host = <database_name>.database.windows.net
port = 1433
tds version = 7.3
同时,您可以参考http://www.freetds.org/userguide/freetdsconf.htm进行配置
我在从源代码 pymssql 和 freetds 生成后解决了它(使用先前 post 中的选项并在全局配置中设置 tds version=7.3)。 Pymssql make from source use command "python setup.py build" 然后下一步在系统中安装 "python setup.py install"