1

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.

jaromey
  • 666
  • 2
  • 10
  • 27
  • 2
    Not sure if answers to this question may help: http://stackoverflow.com/q/6396429/42346 – mechanical_meat Mar 11 '13 at 23:22
  • Hmm... that might just be the problem. The Enthought installation is 32bit but I am actually running 64bit Office. I will install Python on my desktop and see if I have the same issue but I need this to work with my laptop! – jaromey Mar 11 '13 at 23:48
  • The problem is my 64bit installation of office. I just tried it on my desktop and it works perfectly fine. Thanks for saving me the headache as I completely forgot that I had 64bit office. You could put that up as the answer if you want. Any suggestions for getting this to work on my laptop? as there is no free 64bit Enthought installation. – jaromey Mar 12 '13 at 00:24

1 Answers1

1

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.

jaromey
  • 666
  • 2
  • 10
  • 27