I have successfully connected to this database many times before, but just now I have encountered this error:
pyodbc.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')
This is my code:
pathofprog = os.path.dirname(__file__) #Locates the path of the program
dblocation = os.path.join(pathofprog, "Database.accdb") #Locates the database at this path
db = pyodbc.connect('Driver={Microsoft Access Driver (*.mdb, *.accdb)}; Dbq=%s;'%dblocation) #Connects to the database
dbcursor = db.cursor() #Creates the database cursor
Any help would be much appreciated
pyodbc.drivers()
to see if the Microsoft Access Driver is available to your app. – Gord Thompson