Reputation: 676
Background
I have been using a 64bit version of Python 2.7.3. I wanted to learn the matplotlib and numpy libraries so I ended up installing the Enthought Python Distribution for Windows and I also installed ipython to go along with it as well. Now, all of a sudden connection strings that previously worked are no longer working with the pyodbc library in this distribution of Python and I do not have the slightest clue why.
Example
The following code worked perfectly fine before:
import pyodbc
dbFile = r'D:\Dropbox\School\Senior_Project\Database\HarmonicProfileDatabase_be.accdb'
cnxn = pyodbc.connect(r'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ='+dbFile)
But now returns the following error:
Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')
These kind of things make learning programming so frustrating but I am way too close to coming up with a solution for a project that I have been working on to give up now.
Upvotes: 1
Views: 1027
Reputation: 676
The problem was that the version of Python (and also pyodbc) that I was using was 32-bit. However, I managed to get myself a 64-bit version of office. Both of them need to be 32-bit (or both 64-bit) in order for this to work.
Upvotes: 1