Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to connect to a .mdb database from Python using the pyodbc library. The connection string I am using is the following:
Python
import pyodbc

conn = pyodbc.connect('DRIVER={Microsoft Access Driver(*.mdb,*.accdb)};DBQ=C:\\Sample.mdb')


But I keep getting the IM002 error telling me that the data source name is not found and that the driver has not been specified. But the thing is that both of them are present in the ODBC Manager.

What I have tried:

I have tried adding the DSN again in the ODBC Manager. This link : https://social.msdn.microsoft.com/Forums/getfile/1146756 is the User DSN setting and this : https://social.msdn.microsoft.com/Forums/getfile/1146757 is the system DSN setting.

I even created a file DSN to get the complete connection string, and the error still appeared. The PC I am working on is 64 bit, so I changed the directory path in the 'Shortcut' tab of the ODBC Manager properties to point to the SysWOW64 folder. So I am unsure as to what the error is. Any assistance would be useful

I am using 64 bit versions of Python and the pyodbc library. I was wondering if I should downgrade given that I am unsure of the same about MS Access that is installed on the PC.

PS: I seem to have messed up adding the image link. Please copy and paste the link into the browser.
Posted
Updated 18-Oct-17 18:48pm
v2
Comments
Richard MacCutchan 19-Oct-17 4:48am    
Are you certain that you have the ACE driver installed? Is that file accessible to your application (you should not store data files in C:\)?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900