0

I am not able to connect with MS SQL server 2008 R2 by using pyodbc from anaconda environment. Here is the code which I am executing :

import pyodbc
conn=pyodbc.connect("Driver={SQL Server Native Client 11.0};"
                    "Server=server_name;"
                    "Database=db_name;"
                    "Trusted_Connection=yes;")

It gives me following error:

OperationalError: ('08001', '[08001] [Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [53].

I tried Driver={SQL Server}, and getting the following error:

OperationalError: ('08001', '[08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. (17) 

I can connect to the server and db manually. I have referred Unable to connect pyODBC with SQL Server 2008 Express R2

Nitesh Selkari
  • 67
  • 1
  • 2
  • 8

1 Answers1

0

You might want to try:pyodbc.drivers() and try other drivers.

Check here for additionnal information: Connecting to SQL Server from Windows or download {ODBC Driver 11 for SQL Server}: Driver Files - Microsoft

Your code looks fine. Hard to tell from here.

OhMikeGod
  • 107
  • 1
  • 5