I have been trying to connect to my Azure SQL Database on my Ubuntu 14.04 laptop using Python.
I found this article from Microsoft: Connect to SQL Database by using Python on Ubuntu Linux, which showed me how to connect to my SQL Database using Python 2.7.6
I confirmed I met the Python 2.7.6 requirement before getting started:
The output of ryan@laptop:~$ python -V was Python 2.7.6
I followed the instructions and entered the following lines into my terminal:
sudo apt-get --assume-yes update sudo apt-get --assume-yes install freetds-dev freetds-bin sudo apt-get --assume-yes install python-dev python-pip sudo pip install pymssql
Everything installed as expected.
I created a python script and entered my information, here is my code:
#!/usr/bin/python
import pymssql
conn = pymssql.connect(server='ryans_server.database.windows.net', user='ryans_user@ryans_server', password='ryans_password', database='ryans_database')
However, when I execute this code, this is the output:
Traceback (most recent call last):
File "./tp-database.py", line 3, in <module>
conn = pymssql.connect(server='ryans_server.database.windows.net', user='ryans_user@ryans_server', password='ryans_password', database='ryans_database')
File "pymssql.pyx", line 637, in pymssql.connect (pymssql.c:9508)
pymssql.OperationalError: (18456, "Login failed for user 'ryans_user'.DB-Lib error message 18456, severity 14:\nGeneral SQL Server error: Check messages from the SQL Server\nDB-Lib error message 20002, severity 9:\nAdaptive Server connection failed\n")
I have tried: export TDSVER=7.0, which causes a different error:
pymssql.OperationalError: (20017, 'DB-Lib error message 20017, severity 9:\nUnexpected EOF from the server\nDB-Lib error message 20002, severity 9:\nAdaptive Server connection failed\n')
What can I do to connect to my Azure SQL Database?
