title: Connecting to Microsoft Azure SQL Database using Python on Ubuntu 14.04
body: <p>I have been trying to connect to my Azure SQL Database on my Ubuntu 14.04 laptop using Python.</p>
  
  <p>I found this article from Microsoft: <a href="https://azure.microsoft.com/en-us/documentation/articles/sql-database-develop-python-simple-ubuntu-linux/" rel="nofollow" title="Connect to SQL Database by using Python on Ubuntu Linux">Connect to SQL Database by using Python on Ubuntu Linux</a>, which showed me how to connect to my SQL Database using <strong>Python 2.7.6</strong></p>
  
  <hr>
  
  <p>I confirmed I met the Python 2.7.6 requirement before getting started:</p>
  
  <p>The output of <strong><code>ryan@laptop:~$ python -V</code></strong> was <strong><code>Python 2.7.6</code></strong></p>
  
  <hr>
  
  <p>I followed the instructions and entered the following lines into my terminal:</p>
  
  <blockquote>
  <pre><code>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
  </code></pre>
  </blockquote>
  
  <p>Everything installed as expected.</p>
  
  <hr>
  
  <p>I created a python script and entered my information, here is my code:</p>
  
  <pre><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')
  </code></pre>
  
  <hr>
  
  <p>However, when I execute this code, this is the output:</p>
  
  <pre><code>Traceback (most recent call last):
    File "./tp-database.py", line 3, in &lt;module&gt;
      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")
  </code></pre>
  
  <hr>
  
  <p>I have tried: <code>export TDSVER=7.0</code>, which causes a different error:</p>
  
  <pre><code>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')
  </code></pre>
  
  <hr>
  
  <p><strong>What can I do to connect to my Azure SQL Database?</strong></p>