mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.92k stars 561 forks source link

Connect to a .mdb file with pyodbc: Which driver? #1074

Closed Sava112233 closed 2 years ago

Sava112233 commented 2 years ago

Environment

To diagnose, we usually need to know the following, including version numbers. On Windows, be sure to specify 32-bit Python or 64-bit:

Issue

conn = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\Users\me\Desktop\db.mdb;')

That's how I solved the connection to a mdb database file. I want to list all elements with python, but I get a fail in this line. The message is: pyodbc.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')

What could be the reason for this?

gordthompson commented 2 years ago

Check the list returned by pyodbc.drivers() to see what ODBC drivers are available to your Python app.

Sava112233 commented 2 years ago

Did it and got nothing. uninstalled access database engine and installed it again, than got the drivers. Thank you!!