简体   繁体   中英

Unable to connect to SQL Server with Windows Authentication in a Python script on a MAC

I am trying to run a phyton script on my Mac (OS Sierra) to connect to SQL Server (2016) using my login which is a Windows AD authentication but can't seem to get it to work. It throwing an Image not found error message. However, the pytds and pyodbc module both work with another login that uses Sql Server authentication.

I am unable to even trace where the disconnect is. Can someone please advice?

Try this connection string:

conn= pyodbc.connect(r'Driver={SQL 
Server};Server=yourServer;Database=yourDatabase;Trusted_Connection=yes;')

replace yourServer and yourDatabase

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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