PYODBC InterfaceError- Data source name not found

pyodbc connect
pyodbc connect to access database
no driver name specified; this is expected by pyodbc when using dsn-less connections
pyodbc drivers
nameerror: name 'pyodbc' is not defined
pyodbc.interfaceerror ('28000'
pyodbc documentation
mssql+pyodbc

I am trying to connect Python to MS Access Database using pyodbc but every time I get the following error:

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

And this what I have written to connect python to MS Access:

import pyodbc

conn = pyodbc.connect(r'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=D:\PILOT_DATA.accdb;')
cursor = conn.cursor()
cursor.execute('select * from p_inventor')

for row in cursor.fetchall():
    print (row)

According to the error, it doesn't find the Data source name and so I changed the 'DRIVER' to 'DSN'

import pyodbc

conn = pyodbc.connect(r'DSN={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=D:\PILOT_DATA.accdb;')
cursor = conn.cursor()
cursor.execute('select * from p_inventor')

for row in cursor.fetchall():
    print (row)

But it doesn't help. I get the following error:

pyodbc.Error: ('IM010', '[IM010] [Microsoft][ODBC Driver Manager] Data source name too long (0) (SQLDriverConnect)')

Other workaround I have tried is to use both python 32 and 64 bit

Here goes the version details:

  • Python 3.7.4 64 bit
  • pip 19.2.3
  • pyodbc-4.0.27
  • Office365 16

Would be really helpful to know what else I can do to connect Python to ACCESS database. Thanks in Advance!


I have solved this issue by installing the Access Database Engine. In order to do that, I had to unistall the office365 program-> install access database engine-> re-install office365. And then the code runs perfectly!

PYODBC--Data source name not found and no default , Sometimes though, Python can still feel a bit cobbled together when trying to use it on a Windows machine. Ever move from one machine to  pyodbc.InterfaceError: ('IM002', ' [IM002] [Microsoft] [ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)') Getting this error, using windows 10.


According to the pyodbc docs you need to set-up an ODBC and you can check it like so (as @Parfait said) ;

import pyodbc
[x for x in pyodbc.drivers() if x.startswith('Microsoft Access Driver')]

Technical Document: Resolving "Data source name not found and , Unable to get list count: From Connect (driver): SQL state IM002, message: [​Microsoft][ODBC Driver Manager] Data source name not found and no default driver  python - InterfaceError: (pyodbc.InterfaceError) ('IM002', ' [IM002] [unixODBC] [Driver Manager]Data source name not found, and no default driver specified (0) - Stack Overflow.


If Office 365 is installed as "Click-to-Run" (C2R) then some Office components are stored in an "isolated environment" that is not visible to non-Office applications. The Access Database Engine is one of those components.

In that case the solution for using the Access Database Engine from external (non-Office) applications is to download and install the Access Database Engine Redistributable package as explained in the Microsoft Docs article:

Can't use the Access ODBC driver or OLEDB provider outside Office Click-to-Run applications

Using pyodbc with Sql Server : Forums : PythonAnywhere, However I am getting the following error: pyodbc.Error: ('IM002', '[IM002] [​unixODBC][Driver Manager]Data source name not found, and no  Go to control panel -> administrative tools --> select data sources(ODBC) --> then right click on that file --> go to properties --> in the shortcut tab -> change the path from %windir%\System32\odbcad32.exe to


Data source name not found if there is space in DNS name · Issue , I am not able to connect to database if there is space in DNS e.g. "Server A". E.g. I tried to connect with: pyodbc.connect(r'DSN="Server A"  cnxn = pyodbc.connect(access_con_string) Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)') I'm running Office in 32 bit mode on Win7 and python / pyodbc in 32 bit mode


pyodbc.Error: ('01S00', '[01S00] [Microsoft][ODBC Driver , pyodbc.connect( pyodbc.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver  I am trying to use pyodbc with sql server. However I am getting the following error: pyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)')


Hi all, I am trying to connect python by pyodbc to sql data base, but I , data base, but I am getting this error: InterfaceError: ('IM002', '[IM002] [Microsoft​][ODBC Driver Manager] Data source name not found and no  If you reference a DSN that does not exist you will see this error: Make sure you are referencing a DSN that has been created. To see your existing DSN"s go to Control Panel - Data Sources (ODBC). Your ODBC Data Source Administrator will open. Here make sure your DNS exists (under user DSN"s). If it does not then create one (See Resolution 20830).