2
votes

Using SQLAlchemy to connect to SQL Server on Azure. I can access it via JDBC using SQL Workbench/J from same IP.(opened the IP in Azure)

Using the string:

mssql+pymssql://username:[email protected]

Getting:

(pymssql.OperationalError) (20002, b'DB-Lib error message 20002, severity 9:\nAdaptive Server connection failed (nibisql1.database.windows.net:1433)\n') (Background on this error at: http://sqlalche.me/e/e3q8)

I tried all variations, but none of them work.

  1. any idea why?

  2. How do I pass parameters such as databasename?

1
(1) What operating system are you using? (2) Did you install pymssql using pip install pymssql? - Gord Thompson
I got the exact same error with pymssql connecting to Azure. The only way I found to beat this is to switch to pyodbc over unixodbc (or msodbc, whichever suits you needs better). That is if you're on Linux. Works perfectly. - Grisha S
Actually, after a bit more trial and error I found it's not at all straightforward with pyodbc , but it is possible to get it to work - Grisha S
are you using linux? and did you install the drivers for mssql ? - Fabio Schultz

1 Answers

0
votes

Try to change

    mssql+pymssql://username@SQLservername:[email protected]