InterfaceError [Microsoft] [ODBC Driver Manager] Data source name not found and no default driver specified

See original GitHub issue
  • Python: 3.9.7 (32-bit)
  • pyodbc: 4.0.28
  • OS: Window 10 Enterprise 64-bit
  • DB: MsAccess 365 16.0
  • driver: Microsoft Access Driver (*.mdb, *.accdb)

Observed behavior: When I connect the database in VS Code, the connection is made & there are no errors, but when I compile the code into an .exe file w/ pyinstaller, I get the following error.

<class ‘pyodbc.InterfaceError’> (‘IM002’, ‘[IM002] [Microsoft] [ODBC Driver Manager] Data source name not found and no default driver specified (0) (SqlDriverConnect)’)

Here is the connection string: conn_str = (r"DRIVER=Microsoft Access Driver (*.mdb, *.accdb); DBQ="networkdrive\myDb.accdb;") conn = pyodbc.connect(conn_str) crsr = conn.cursor()

Expected Behavior: Connection to the database is made successfully

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
gordthompsoncommented, Oct 27, 2021

Try creating an executable using the same procedure as your example above except that the python code to run is

import pyodbc

print(pyodbc.drivers())

to see what drivers are available in that context.

0reactions
MehmetUzelcommented, Dec 1, 2022

Try creating an executable using the same procedure as your example above except that the python code to run is

import pyodbc

print(pyodbc.drivers())

This saved my 4 days thank you very much

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Microsoft][ODBC Driver Manager] Data source name not ...
Got this error because I had the Data Source Name in User DSN instead of System DSN ... Manager] Data source name not...
Read more >
How to Resolve: [IM002] [Microsoft][ODBC Driver Manager ...
How to Resolve: [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)
Read more >
[ODBC Driver Manager] Data source name not found and no ...
Error : [ODBC Driver Manager] Data source name not found and no default driver specified. Hi. I am trying to connect to AS...
Read more >
DataDirect "Data source name not found and no default driver ...
Information · Verify that the ODBCINI (or ODBC_INI or SHADOW_INI) environment variable points to the correct odbc.ini (or shadow. · Verify that ...
Read more >
Resolving "Data source name not found and no default driver ...
... Connect (driver): SQL state IM002, message: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found