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)

2
  • Can you show some demo code? I can use sqlalche to connect my azure mssql. Commented Dec 12, 2018 at 0:44
  • If the answer below works for you, could you help mark it? thanks very much. Commented Dec 14, 2018 at 10:02

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.