2

My company just upgraded me from the desktop version of MS Access 2010 to O365. In doing so, has created an issue with some pre-existing python code. When I execute the pyodbc.connect command to connect to MS Access, I am getting:

conn = pyodbc.connect(

pyodbc.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')

The code that I am using is

conn = pyodbc.connect(
    r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};'
    r'DBQ=C:\Data\Analytics\Database\VA VULN Cleanup.accdb;')

This is code that has run with no issue for years.

We have deleted and installed the 32 bit and 64 bit version of the drivers with no success. My searches for possible solutions has come up empty.

(Added 04/18/23) I had already reviewed the proposed duplicate suggestion. I have validated that the correct drivers are installed, I have tried both the 32 bit and 64 bitness drivers and have confirmed there is no error in typing the driver name. Thus I am still looking for suggestions on a viable course of action. Here is my current ODBC Drivers:

enter image description here

Andre
  • 26,751
  • 7
  • 36
  • 80
Starr
  • 21
  • 2
  • If you use office 365 with the C2R installer, ODBC drivers may not be available to Python, but you can fix this by installing the database engine separately (or by installing a non-C2R version which should be available on Office.com -> apps and devices (and not install apps for some reason)) – Erik A Apr 17 '23 at 14:05
  • I confirmed that 365 was installed with the C2R installer. We did install the ODBC drivers separately while trouble shooting. I am running the 2016 DB engine. I will be unable to install anything directly off of the Office website since my company has a specific deployment. Appreciate any other suggestions that you may have, or additional questions that I can research to help give more details. – Starr Apr 18 '23 at 13:28
  • Interesting, are you sure you're running Python locally (no central Jupyter stuff) and it's 64-bits? Can you run `pyodbc.drivers()` and `import platform; platform.architecture()[0]`? This error should not be able to occur if the driver is installed in matching bitness on the machine the code is running on and without typo's, so something really strange has to be going on. – Erik A Apr 18 '23 at 13:43
  • This is the hint I needed for success. (THANK YOU). Running the pyodbc.drivers command showed that I was running [Microsoft Access (*.mdb)] when it should be the 64 bit [Microsoft Access Driver (*.mdb, *.accdb)]. The platform.architecture command showed that I was running 32 bit Python. I had been concentrating on the drivers bitness. What I believe happened was that the version of Access I was running locally was 32 bit. When migrating to 365, it was upgraded to 64 bit. I had not occurred to me that python needed to be reinstalled using 64 bit. This did the trick!! – Starr Apr 19 '23 at 11:58
  • Happy to help! If you don't mind, I'm marking this as a duplicate again, since the case of mismatching bitness between program and driver is mentioned there, and I'd like to redirect future visitors to the exhaustive list. – Erik A Apr 19 '23 at 12:14
  • Works for me. The element that was missing for me, was two commands you provided. However, utilizing hindsight, it is much clearer. – Starr Apr 20 '23 at 10:53

0 Answers0