title: Connect to SQL Server database from RHEL with Windows Authentication
body: <p>I have been working for two weeks in the installation of Superset (from Airbnb) for data visualization on a virtual RHEL machine and the connection with a SQL Server database. But I still cannot connect to this database because of a problem of driver I guess. I tried many things and I would like to know if you have a solution, about a driver I need, about modifications in my configuration etc... 
  Someone told me about jTDS driver. Maybe I need something like this but for python. If you have any idea, here is what I already did.</p>
  
  <p>1) I tried to connect to the database from Superset :</p>
  
  <p>SQL Alchemy URI : <code>mssql://user:password@fr0-iacls-190.eu.company.corp:10001/dbname</code></p>
  
  <pre><code>ERROR : {"error": "Connection failed!\n\n
  The error message returned was:\n(pyodbc.Error) ('IM002', '[IM002] [unixODBC][DriverManager]
  Data source name not found, and no default driver specidied (0) (SQLDriverConnect)')"}
  </code></pre>
  
  <p>2) I tried almost the same with mssql+pymssql :</p>
  
  <p>SQL Alchemy URI : <code>mssql+pymssql://user:password@fr0-iacls-190.eu.company.corp:10001/dbname</code></p>
  
  <pre><code>ERROR:{"error":"Connection failed!\n\n
  The error message returned was:\n(pymssql.OperationalError) (18456, 'DB-Lib error message 20018,
  severity 14:\\nGeneral SQL Server error: Check messages from the SQL Server\\n
  DB-Lib error message 20002, severity 9:\\n Adaptive Server connection failed (fr0-iacls-190.eu.company.corp:10001)\\n')"}
  </code></pre>
  
  <p>3) I tried to connect to the database from my terminal on virtual RHEL machine :</p>
  
  <pre><code># tsql -S fr0-iacls-190.eu.company.corp -U user
    Password:
    locale is "en_US.UTF-8"
    locale charset is "UTF-8"
    using default charset "UTF-8"
    20^C
  </code></pre>
  
  <p>Here I have a timer that increase the number every second. I stopped the example after 20 seconds.</p>
  
  <p>4) Finally I tried a python script like this one : </p>
  
  <pre><code>import pyodbc
  cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=fr0-iacls-190.eu.company.corp;DATABASE=dbname;UID=;PWD=password')
  </code></pre>
  
  <p>The empty UID is a tip used in another StackOverflow post.</p>
  
  <pre><code># python connect.py
    Traceback (most recent call last):
    File "connect.py", line 2, in &lt;module&gt;
    cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=fr0-iacls-190.eu.company.corp;DATABASE=dbname;UID=;PWD=password')
    pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'SQL Server' : file not found (0) (SQLDriverConnect)")
  </code></pre>
  
  <p>To finish, I read about two files, odbc.ini and odbcinst.ini but I don't know if they are in the good directory (/etc). I am not working on root (~) but in in the parent directory of root (cd ~/..)...</p>
  
  <p>Here are the two files if necessary : </p>
  
  <p>odbc.ini</p>
  
  <pre><code>;
  ;  odbc.ini
  ;
  [ODBC Data Sources]
  JDBC = Sybase JDBC Server
  
  [JDBC]
  Driver          = /usr/local/lib/libtdsodbc.so
  Description     = Sybase JDBC Server
  Trace           = No
  Servername      = JDBC
  Database        = pubs2
  UID             = guest
  
  [Default]
  Driver          = /usr/local/lib/libtdsodbc.so
  </code></pre>
  
  <p>odbcinst.ini</p>
  
  <pre><code>[PostgreSQL]
  Description=ODBC for PostgreSQL
  Driver=/usr/lib/psqlodbcw.so
  Setup=/usr/lib/libodbcpsqlS.so
  Driver64=/usr/lib64/psqlodbcw.so
  Setup64=/usr/lib64/libodbcpsqlS.so
  FileUsage=1
  
  [MySQL]
  Description=ODBC for MySQL
  Driver=/usr/lib/libmyodbc5.so
  Setup=/usr/lib/libodbcmyS.so
  Driver64=/usr/lib64/libmyodbc5.so
  Setup64=/usr/lib64/libodbcmyS.so
  FileUsage=1
  
  [MSSQLTest]
  Driver = ODBC Driver 13 for SQL Server
  Server = [http:]fr0-iacls-190.eu.company.corp[,10001]
  #
  # Note:
  # Port is not a valid keyword in the ~/.odbc.ini file
  # for the Microsoft ODBC driver on Linux
  #
  
  [ODBC Driver 13 for SQL Server]
  Description=Microsoft ODBC Driver 13 for SQL Server
  Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.4.0
  UsageCount=1
  </code></pre>
  
  <p>Many thanks for your time and your help.</p>