简体   繁体   English

pyodbc 的 Cnn 字符串,带有“trusted_connection=yes”而不是用户 ID 和密码

[英]Cnn string for pyodbc with “trusted_connection=yes” instead of userid & password

i'm using below code for cnnString, is there any other way without giving userID & password and pass trusted_Connection as true??我正在为cnnString使用下面的代码,是否有任何其他方法不提供用户ID和密码并将trusted_Connection作为true传递?

cnnString = 'Driver={SQL Server Native Client11.0};Server=XXXXX;Database=XXXXX;UID=XXXX;PWD=XXXXX'
qry = 'select * from View_Dim_Supp' #or open('myqueryfilepath', 'r').read()
cnn = pyodbc.connect(cnnString)
df = pd.read_sql(qry, cnn)

I got the answer我得到了答案

cnnString = 'Driver={SQL Server Native Client 11.0};Server=XXXX;Database=XXXX;trusted_connection=yes'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM