3
votes

I am trying to connect pyodbc to an mdb file. I have searched this site and tried a number of things without success. Here is an overview of my system.

Windows 7 Ultimate Service Pack 1
64 Operating System
Python 3.4.0 installed in C:\Python34\ installed using python-3.4.0.amd64.msi
pyodbc 3.0.7 installed using pyodbc-3.0.7.win-amd64-py3.4.exe
Installed AccessDatabaseEngine.exe 14.0.6119.5000 MS 2007 Office System Driver
Control Panel\All Control Panel Items\Administrative Tools Data Sources (ODBC) set to %windir%\SysWOW64\odbcad32.exe
Permissions in the Registry for my user profile set to Full for Microsoft Access Driver (*.mdb, *.accdb)

The code that I am using is:
import csv, pyodbc
conn=pyodbc.connect('Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=c:\MDBTest\MyTestMdb.mdb;')

The error that I continue to get using a number of variations of the code is:
conn=pyodbc.connect('Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=c:\MDBTest\MyTestMdb.mdb;')
pyodbc.Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')

Thanks in advance for your help.

1

1 Answers

3
votes

You are using a 64-bit version of Python but you have the 32-bit version of the Access Database Engine installed. You either need to

  • run a 32-bit version of Python, or
  • remove the 32-bit version of the Access Database Engine and install the 64-bit version (available here).