title: Can't open lib 'ODBC Driver 17 for SQL Server' : file not found
body: <p>I am fairly new to Python and Azure web apps.  Any help is appreciated.</p>
  
  <p>My setup:</p>
  
  <ul>
  <li>Program: Visual Studio code</li>
  <li>Language: Python-Flask</li>
  <li>Cloud provider: Microsoft Azure</li>
  <li>Database: Azure SQL DB</li>
  <li>Deployment option: Docker image > Azure container registry > Deploy the image to the Web app</li>
  <li>Web App OS: Linux (I think Alpine?)</li>
  </ul>
  
  <p>In my code, I am using <code>pyodbc</code> to connect to the Azure SQL DB.  The code runs successfully locally in the terminal.  However, when it runs on the web, it encounters the following error:</p>
  
  <p><code>Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)")</code></p>
  
  <p>I followed several troubleshooting posts, however, I have not been successful.  </p>
  
  <p>I tried using the $sudo ln to create a symbolic link that resulted in permission denied.  I think this is a known limitation of the Azure web app.  </p>
  
  <p>I tried to look for the driver in etc/odbcinst.ini to see if the driver name exists, however, I am pretty new to Azure / VS Code so I do not even know how to open the file that is in the, etc/ folder.  I do see it in the BASH command prompt when I navigate to the etc/ folder but not sure how to open the file.</p>
  
  <p>I ran the following command in the <code>BASH</code> to install <code>PYODBC</code>, but that didn't resolve the issue. </p>
  
  <pre class="lang-py prettyprint-override"><code>python -m pip install pyodbc
  </code></pre>
  
  <p>The result from <code>odbcinst -j</code></p>
  
  <pre><code>    unixODBC 2.3.4
      DRIVERS............: /etc/odbcinst.ini
      SYSTEM DATA SOURCES: /etc/odbc.ini
      FILE DATA SOURCES..: /etc/ODBCDataSources
      USER DATA SOURCES..: /home/a49d42b0d7b8ce200a4f7e74/.odbc.ini
      SQLULEN Size.......: 8
      SQLLEN Size........: 8
      SQLSETPOSIROW Size.: 8
  </code></pre>
  
  <p>My dockerFile:</p>
  
  <pre><code># Pull a pre-built alpine docker image with nginx and python3 installed
  FROM tiangolo/uwsgi-nginx-flask:python3.6-alpine3.7
  
  ENV LISTEN_PORT=8000
  EXPOSE 8000
  
  COPY /app /app
  
  # Uncomment to install additional requirements from a requirements.txt file
  COPY requirements.txt /
  RUN pip install --no-cache-dir -U pip
  RUN pip install --no-cache-dir -r /requirements.txt
  
  RUN apk add g++
  RUN apk add unixodbc-dev
  RUN pip install pyodbc
  </code></pre>
  
  <p>My requirements.txt.  I commented out <code>pyodbc</code>; I think that's okay since I am installing it in the docker file.</p>
  
  <pre><code>click==6.7
  Flask==0.12.2
  itsdangerous==0.24
  Jinja2==2.10
  MarkupSafe==1.0
  Werkzeug==0.14.1
  #pyodbc==4.0.28
  </code></pre>
  
  <p>Additional questions:</p>
  
  <ol>
  <li>Should I be using PYODBC? or is there something better / more compatible I should be using?</li>
  <li>Should I use MYSQL instead of Azure SQL DB? </li>
  <li>Is there a way for me to open the <code>odbcinst.ini</code> file that is on the web app?</li>
  </ol>