Hi everyone,
I'm having difficulty connecting to an MS Access database using pyodbc and hope someone on the forum might have a quick fix for this.
import pyodbc
strPathFileDb = 'C:\\full\\path\\to\\database.accdb'
strConnectString = 'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=' + strPathFileDb + ';'
oDbConnection = pyodbc.connect( strConnectString )
Running the above program produces the following error:
pyodbc.Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source not found and no default driver specified (0) (SQLDriverConnect)')
OS: Windows 7 Home Premium 64-bit
Access version: Access 2013 32-bit
Python version: Python 3.3.2 32-bit
pyodbc version: 3.0.7 32-bit
The exact code works without a hitch on a Win7 64 bit system running 64-bit versions of Access, Python, and pyodbc.
I have already tried using 64-bit versions of Python/pyodbc and changing around connection strings to no avail.
I suspect the problem is related to the underlying ODBC driver... Maybe 64-bit Windows ODBC drivers clash with the 32-bit version of Access installed?
Are there two ODBC drivers (64-bit and 32-bit) available in Win7 64-bit and, if yes, could it be that the wrong driver gets called by pyodbc?
Thanks for any input!