用于支持windows身份验证的pymssql模块。现在看来不是了。尽管在某些地方它仍然显示出它应该起作用。我一直找不到这个问题的确切答案,也找不到解决办法。最相关的链接:pymssql 1.0 supported it because it made use of and depended on the
MS-provided DLL which was part of the SQL Server client stack. This
stack was in charge of handling all of the NTLM negotiation and such.
This meant, among other things that it was a Windows-only solution.
我可以模拟多种网络环境,所以我尝试了许多不同的设置。我正在尝试使用此脚本使用windows身份验证连接到远程MSSQL服务器。这就是问题所在。
根据我的研究,包括上面的链接,有两种方法可以在pymssql模块中使用windows身份验证,即假定工作。
第一种方法:使用当前用户凭据:pymssql.connect(server='server')
# credentials come from active windows session
# some research shows that a "trusted=True" keyword should be provided.
第二种方法:使用给定的用户凭据:pymssql.connect(server='server', user=r'domain\user', password='pass')
# credentials are given in code and somehow converted to a
# windows authentication in the background
# some research shows that a "trusted=True" keyword should be provided.
使用_mssql模块也是如此。
注意:Python版本:2.7.8
我正在使用的PymSql版本:2.1.1
用于支持windows身份验证的PymSQL版本:1.x
我用(所有64位)进行了测试:
windows 7专业版
windows 7家庭高级版
windows服务器2012
windows服务器2012R2
本专题的其他问题: