views:

21

answers:

2

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?

A: 

...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

Delta
+1  A: 

install SQLNCLI. if it still not working change :

"Provider=SQLNCLI;server=%...

to

"Provider=SQLNCLI10;server=%...
singularity