Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft Access Driver: Specified driver could not be loaded due to system error 1114

I'm trying to connect to a .mdb database using the pyodbc module with the following code:

import pyodbc

MDB = 'C:\\Program Files (x86)\\OnCourt\\OnCourt.mdb'
DRV = '{Microsoft Access Driver (*.mdb, *.accdb)}'
PWD = 'qKbE8lWacmYQsZ2'
conn = pyodbc.connect('DRIVER={};DBQ={};PWD={}'.format(DRV,MDB,PWD))

This normally works absolutely fine but stopped working today, and I can't think why. This is the error I get:

InterfaceError: ('IM003', '[IM003] Specified driver could not be loaded due to system error 1114: A dynamic link library (DLL) initialization routine failed. (Microsoft Access Driver (*.mdb, *.accdb), C:\Program Files\Microsoft Office\root\VFS\ProgramFilesCommonX64\Microsoft Shared\Office16\ACEODBC.DLL). (160) (SQLDriverConnect)')

I don't think it's anything specific to the database I'm trying to access as when I try to configure the driver from within ODBC data sources, I get essentially the same error there too:

enter image description here

like image 911
Tom Dry Avatar asked Jan 25 '23 18:01

Tom Dry


1 Answers

I had the exact same problem! I fixed it by uninstalling the driver and reinstalling it from https://www.microsoft.com/en-us/download/details.aspx?id=54920.

When I tried to re-install the first time, it whined that "You cannot install the 32-bit version of access because you currently have 64-bit Office products installed" and asked me to uninstall Office 16 Click-to-Run Extensibility Component 64-bit registration. So I followed the directions here to uninstall that, then installed the driver. My program worked again!

No idea why that worked. Maybe an update screwed it up somehow? Who knows. Hope it works for you!

like image 99
Python Pastor Avatar answered Jan 27 '23 08:01

Python Pastor