I´m having problem connecting SQL and python through pyodbc.
I´ve tried most of the drivers names and inclusions in the system, but I keep having the same issue.
CODE:
import pyodbc
conn = pyodbc.connect(
"Driver='{SQL Server Native Client 11.0}';"
"Server = server;"
"Database = db;"
"username = xxx;"
"password = xxxxxxxxx;"
"Trusted_Connection = yes;")
cursor = conn.cursor()
cursor.execute('SELECT * FROM db.table')
for row in cursor:
print(row)
Error:
InterfaceError Traceback (most recent call last)
<ipython-input-36-04dae4d66996> in <module>()
1 import pyodbc
2 conn = pyodbc.connect(
----> 3 "Driver='{SQL Server Native Client 11.0}';"
4 "Server = server;"
5 "Database = db;"
InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')