Home > Mobile >  How to install "Microsoft Access Driver (*.mdb, *.accdb)" driver in Alpine Linux Docker Co
How to install "Microsoft Access Driver (*.mdb, *.accdb)" driver in Alpine Linux Docker Co

Time:11-25

Script to find all drivers

I created a script to find all 'pyodbc' drivers:

import pyodbc

print([x for x in pyodbc.drivers()])

The problem

In my host computer (Windows with drivers installed), when I'm run i get all x64 drivers:

> ['SQL Server', 'ODBC Driver 17 for SQL Server', 'Microsoft Access Driver (*.mdb, *.accdb)', 'Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)', 'Microsoft Access dBASE Driver (*.dbf, *.ndx, *.mdx)', 'Microsoft Access Text Driver (*.txt, *.csv)']

But, when I use Docker

FROM python:3.8-alpine

# Add dependencies
RUN apk upgrade
RUN apk add --no-cache curl gcc g   unixodbc-dev
RUN ln -s /usr/include/locale.h /usr/include/xlocale.h

WORKDIR /app

# Install Python dependencies
COPY requirements.txt ./
RUN pip install --upgrade pip
RUN pip install -r requirements.txt

# Run script
COPY find_drivers.py find_drivers.py
CMD [ "python3", "find_drivers.py" ]

Drivers are not found:

> []

References

What the best way to install "Microsoft Access Driver (*.mdb, *.accdb)" in this Docker image?

CodePudding user response:

What the best way to install "Microsoft Access Driver (*.mdb, *.accdb)" in this [Alpine Linux] Docker image?

You can't. Microsoft only provides "Microsoft Access Driver (*.mdb, *.accdb)" for the Windows platform (unlike their ODBC driver for SQL Server which is available for Windows, Linux, and Mac).

Some alternatives are discussed here:

Working with an Access database in Python on non-Windows platform (Linux or Mac)

  • Related