0

I trying connect to mysql db from VM, with python driver pymssql.

_connection = mysql.connect(host="xxxxxx.database.windows.net", user='xxxxxx@xxxxxx',
                                  password='xxxxx', database='xxxxxx')

But i get exeption like this

File "pymssql.pyx", line 641, in pymssql.connect (pymssql.c:10824) pymssql.OperationalError: (20002, b'DB-Lib error message 20002, severity 9:\nAdaptive Server connection failed (my-xxxxx.database.windows.net:1433)\n')

When I connecting to this database from my local pc all good.

P.S. I opened all ports for all protocols on my VM

alexander.polomodov
  • 5,396
  • 14
  • 39
  • 46

1 Answers1

0

Per my experience, Python pymssql package is depended on freetds-common package which will be installed when using sudo apt install python-pymssql command to install it.

And for Azure SQL Database, you need to set the tds version with 7.3, so please refer to my anser for the other similar SO thread pymssql: Connection to the database only works sometimes to check whether the freetds has been install and what the tds version in the configuration file /etc/freetds/freetds.conf is.

Hope it helps.

Peter Pan
  • 23,476
  • 4
  • 25
  • 43