I have a SQL Server running on docker. I'm trying to connect to it from a web app written in python3 with pymssql.
It's working until I run the same app inside a docker container.
I get this error:
20002, b'DB-Lib error message 20002, severity 9:\nAdaptive Server connection failed (nameofmydb.database.windows.net:1433)\n'.
Code:
pymssql.connect(server='mydb.database.windows.net', port='1433', database='mydb', user='user@server', password='pwd')
I tried with --net=host
but it doesn't work either.
Can someone help me, please?
EDIT: So i finally succeeded after around 2 days , it was because of the installation of odbc driver in the container i was doing it in a wrong way. Also i was forced to use pyodbc yes. Install the odbc drivers + python the way azure tell you to in the docs and use pyodbc and not pymssql (which works outside of docker).