3

I'm trying to access microsoft AZURE paid SQL database. I'm using the following

cnxn = pyodbc.connect('DRIVER={ODBC Driver 13 for SQL Server};Server=myserverhere,1433;Database=serverdb;Uid=myuidhere;Pwd={passhere};Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;')

I've followed their installation instructions everytime I run the file I get

pyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)')

1 Answer 1

3

It seems that you connect to sql server from linux, you have to change the driver:

conn = pyodbc.connect(r'DRIVER={FreeTDS};SERVER=myserverhere;PORT=1433;DATABASE=serverdb;UID=myuidhere;PWD={passhere};Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;') 
Sign up to request clarification or add additional context in comments.

4 Comments

Yes, I've setup FreeTDS server finally now. However I'm running through loads of issues with it.
pyodbc.Error: ('08001', '[08001] [unixODBC][FreeTDS][SQL Server]Unable to connect to data source (0) (SQLDriverConnect)')
FreeTDS is correct, I think your query string has issue, can you share your current using one? note my answer added one parameter PORT=1433 based on the query in your question.
Got it. Silly me I add tcp: under my server hence it was throwing me error :) Thanks!

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.