Python Forum
Why do I get this error when I try to access MSAccess database from python?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why do I get this error when I try to access MSAccess database from python?
#1
I tried accessing my MSAccess database from python. Why do i get this error ? Please help me to fix this?
pypyodbc.Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified')
Reply
#2
Because you need to supply a data source name when using odbc.  Other connectors use a file name (sqllite), or an ip address to connect to (...any other connector).  Otherwise, how is the library supposed to know which database you're trying to connect to?
Reply
#3
Hello

I had some trouble with MS Access DB in the past. Careful with 32 Bit or 64 Bit

connstr = (
    r'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};'
    r'DBQ=C:\mypath\myaccessdb.accdb;'
    )
conn = pyodbc.connect(connstr)
cur = conn.cursor()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  access is denied error 5 for network drive mapping ? ahmedbarbary 2 1,731 Aug-17-2022, 10:09 PM
Last Post: ahmedbarbary
  Server Folder Error : WinError5 Access Denied fioranosnake 1 1,092 Jun-21-2022, 11:11 PM
Last Post: Larz60+
  error 1102 (42000) incorrect database name 's' Anldra12 4 1,650 Jun-08-2022, 09:00 AM
Last Post: Anldra12
  mySQL Database error not resolving. cybertooth 2 3,115 Aug-30-2021, 05:45 PM
Last Post: ibreeden
  Error creating database with python and form? shams 3 2,328 Aug-02-2021, 02:00 PM
Last Post: deanhystad
  Can't access the net using Python's Selenium module ShishirModi 2 2,009 Jul-21-2020, 06:03 AM
Last Post: ShishirModi
  Python for MS Access DB Kundan 0 1,847 Feb-20-2020, 08:27 AM
Last Post: Kundan
  Access list items in Python kamaleon 2 2,299 Dec-31-2019, 11:10 AM
Last Post: kamaleon
  Error in Database connectivity with python3.7 srm 8 4,407 May-13-2019, 07:28 AM
Last Post: srm
  How retrieve sqlite3 database saved image and access in python3 tao01 1 2,427 Dec-22-2018, 09:04 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020