Remote connection to MS SQL - Error using pyodbc vs success using SQL Server Management Studio

前端 未结 4 465
轮回少年
轮回少年 2021-01-18 21:00

I have a MS SQL database in the same network but in other computer. Using the SQL Server Management Studio (SSMS) Express, I can find the database and connect without proble

4条回答
  •  悲哀的现实
    2021-01-18 21:04

    I have this problem.I can connect with Management Studio (SSMS) but not work with pyodbc. I add version odbc of sql and worked.

    change your code to:

    conn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server + ';DATABASE=' + db +';UID=' + user + ';PWD=' + password)
    

    If not work change version 17 to 13 if not to 11 . List versions of ODBC.

提交回复
热议问题