1

Anyone know how to solve this error? Trying to connect to Azure SQL Server.

Thanks a ton!

InterfaceError: (pyodbc.InterfaceError) ('IM002', u'[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)') (Background on this error at: http://sqlalche.me/e/rvf5)

Ivan Glasenberg
  • 29,865
  • 2
  • 44
  • 60

1 Answers1

1

Without your code, but just from the error message, it seams that there is some issue with your connection string.

You can use the code below for test:

import pyodbc
from sqlalchemy import create_engine
import urllib

params = urllib.quote_plus \
(r'Driver={ODBC Driver 13 for SQL Server};Server=tcp:yourDBServerName.database.windows.net,1433;Database=dbname;Uid=username@dbserverName;Pwd=xxx;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;')
conn_str = 'mssql+pyodbc:///?odbc_connect={}'.format(params)
engine_azure = create_engine(conn_str,echo=True)

print('connection is ok')

Hope it helps. And please let me know if any further issue.

Ivan Glasenberg
  • 29,865
  • 2
  • 44
  • 60