provider cannot be found error in python connecting to SQL Server

前提是你 提交于 2019-12-11 13:44:58

问题


I'm attempting to connect to a SQL Server database within a Python script. I'm using SQLNCLI as provider on my connection string.

from win32com.client import Dispatch

connection_string = "Provider=SQLNCLI;server=%s;initial catalog=%s;user id=%s;password=%s"%(server,db_name,user,pwd)

dbConn = Dispatch("ADODB.Connection")

dbConn.Open( connection_string )

When executing the script I get this error:

provider cannot be found. It may not be properly installed.

Any ideas on how to fix this?


回答1:


install SQLNCLI. if it still not working change :

"Provider=SQLNCLI;server=%...

to

"Provider=SQLNCLI10;server=%...



回答2:


...It is so simple just install this: SQLNCLI.msi

you can find it here: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=d09c1d60-a13c-4479-9b91-9e8b9d835cdc&displaylang=en



来源:https://stackoverflow.com/questions/4026776/provider-cannot-be-found-error-in-python-connecting-to-sql-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!