2

I am trying to connect my access database so I can dump my data into the table in the database. This the code I use:

import pyodbc
access_database_file = "C:\\Users\\Moyp\\DataPointe.accdb"
ODBC_CONN_STR = 'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=%s;' %access_database_file
conn = pyodbc.connect(ODBC_CONN_STR)

However, I keep receiving this error:

Traceback (most recent call last):
  File "C:\Anaconda\lib\site-packages\IPython\core\interactiveshell.py", line 3035, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-6-a4daec7c49a9>", line 1, in <module>
    conn = pyodbc.connect(ODBC_CONN_STR)
Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')

1 Answer 1

6

I fixed the issue. I was using 64 bit Python and 32 bit MS Access. After I downgraded my 64 bit Python to 32 it worked fine.

Sign up to request clarification or add additional context in comments.

1 Comment

@ I am not George: Where do you find the settings?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.