Connecting to MS SQL Server with Windows Authentication using Python?

后端 未结 3 1875
一整个雨季
一整个雨季 2020-12-01 00:14

How do I connect MS SQL Server using Windows Authentication, with the pyodbc library?

I can connect via MS Access and SQL Server Management Studio, but cannot get a

3条回答
  •  猫巷女王i
    2020-12-01 00:47

    Just wanted to add something as I see the solutions here using localhost; in my experience, SQL Server has issues with this, not sure if its the ODBC driver or the service itse, and prefers the use of (local) if you don't want to specify the local machines name.

    cnxn = connect(driver='{SQL Server}', server='(local)', database='test',               
                   trusted_connection='yes')
    

提交回复
热议问题