问题
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