Python connect o Access error
Question: I am using Python 2.7.8 32-bit to call MS Access 2007.

Below is the code I use:

    
    
    import sys
    import pypyodbc
    import os
    import pyodbc
    
    conn = pyodbc.connect(r"DRIVER={Microsoft Access Driver (*.mdb, *.accdb)}; Dbq=D:\Access\Geocoding.accdb;")
    cnxn   = pyodbc.connect(conn)
    

I get the error message:

Traceback (most recent call last): File "D:\Access\get_Access.py", line 13, in
conn = pyodbc.connect(r"DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};
Dbq=D:\Access\Geocoding.accdb;") Error: ('IM002', '[IM002] [Microsoft][ODBC
Driver Manager] Data source name not found and no default driver specified (0)
(SQLDriverConnect)')

I searched online for a while and couldn't find anything wrong with the code.


Answer: I solved the problem. The Access database is created in Access 2013. I am try
to use Python to connect it in Access 2007, that is the problem.

I created a Access 2007 database and copy all the data into it. Python can
connect to it without problem.

