Ekaterina Ermilova
Ekaterina Ermilova

Reputation: 117

Connect to Access 2013 with Python: Data source name not found

I use this code to connect to Access 2013:

conn_str = r"Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:\_DELOITTE\Statistics.mdb;"
self.conn = pyodbc.connect(conn_str)

I get the following error:

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

I use Windows 8, Intel processor, 32-bit Access, and Python 2.7.

In Administrative Tools I have ODBC Data Sources (32-bit) and ODBC Data Sources (64-bit) both pointing at %windir%\system32\odbcad32.exe. Only "System DSN" is filled in, but no "User DSN".

System DSN

Upvotes: 2

Views: 1323

Answers (1)

disflux
disflux

Reputation: 439

This could be incompatibility if you are using 64bit Python. I just tested something similar on my machine.

This isn't conclusive since these are different versions of Python, but it is a lead to follow. Here's what I tested:

32bit Python 2.7, on a 32bit MS Access driver. Connection successful, no errors.

64bit Python 3.4, on a 32bit MS Access driver. Returned Error: "pyodbc.Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source na me not found and no default driver specified (0) (SQLDriverConnect)')"

Upvotes: 4

Related Questions