2

After getting a new computer that is 64-bit I am getting the following error when I run my Python script that connects fine on my 32-bit computers. I am attempting to connect to an Access database. I am using 64-bit versions of python and pyodbc

Error message: pyodbc.Error: ('IM002', '[IMO] [Microsoft] [ODBC Driver Manager] Data source name not found and no default driver specified

Connection code I'm using that works great in 32-bit PC's:

cnxn = pyodbc.connect(r'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=managermeta.mdb; Provider=MSDASQL;')
wilbev
  • 5,391
  • 7
  • 28
  • 30

1 Answers1

5

Download the 64-bit Office 2010 drivers from here. I was only able to test with an Access 2010 database, but it should work for 2007 also. You don't need the Provider attribute of the connection string.

cnxn = pyodbc.connect(r'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=managermeta.mdb;')
Bryan
  • 17,112
  • 7
  • 57
  • 80
  • Thanks for the answer beargle. I did try to download this before and then just now again. It won't let me install since I have a 32-bit version of office installed on my computer. So that is probably my problem, huh? If so, I try to get the 64-bit version of Office on my PC if my company will let me. – wilbev Jul 31 '13 at 04:29
  • 1
    @wilbev See [this SO answer](http://stackoverflow.com/questions/7116019/hand-install-of-64-bit-ms-access-odbc-drivers-when-32-bit-office-is-present) if you want to attempt a side by side install of 32 and 64 bit Office drivers. – Bryan Jul 31 '13 at 13:33
  • I was successfully able to install the 64-bit version of the office driver based on your tips but I'm still getting the same error in my script. I've tried connecting to mdb file by typing in the hard folder path with works, so I'm still at a lost why it won't connect in my script. – wilbev Aug 01 '13 at 00:59
  • I downloaded and installed the 32-bit driver, and after that my code worked like a charm. Thanks! – Charlie Lefrak Jan 10 '17 at 14:53