PYODBC--Data source name not found and no default driver specified

后端 未结 15 1824
暖寄归人
暖寄归人 2020-11-28 13:01
import pyodbc
connection = pyodbc.connect(\'Driver = {SQL Server};Server=SIWSQL43A\\SIMSSPROD43A;\'
                            \'Database=CSM_reporting;Trusted_Conn         


        
15条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-28 13:23

    I faced this issue and was looking for the solution. Finally I was trying all the options from the https://github.com/mkleehammer/pyodbc/wiki/Connecting-to-SQL-Server-from-Windows , and for my MSSQL 12 only "{ODBC Driver 11 for SQL Server}" works. Just try it one by one. And the second important thing you have to get correct server name, because I thought preciously that I need to set \SQLEXPRESS in all of the cases, but found out that you have to set EXACTLY what you see in the server properties. Example on the screenshot:

提交回复
热议问题