Skip to content Skip to sidebar Skip to footer

Driver Not Found Even Though It's Listed In Pyodbc.datasources()

I tried to access MS Access .mdb database using pyodbc. I've set up the ODBC driver, The driver has been registered to my DSN and I can find in the pyodbc.dataSources() ​sources

Solution 1:

The list produced by pyodbc.dataSources() is misleading because it shows the results from both the 32-bit and 64-bit "Platform". On a machine with 32-bit Office, running your code under 64-bit Python will produce the list

Excel Files [Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)]
MS Access Database [Microsoft Access Driver (*.mdb, *.accdb)]

but if we open the 64-bit ODBC Administrator we see that they are both for the 32-bit "Platform"

odbc64.png

and the associated drivers will not be available to pyodbc running under 64-bit Python.

A more reliable way to get the list of available drivers is to use

drivers = pyodbc.drivers()
print(drivers)

That should only show you the drivers that are available to your particular "Platform" (i.e., 64-bit or 32-bit Python).

Post a Comment for "Driver Not Found Even Though It's Listed In Pyodbc.datasources()"