Reputation: 63
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
Upvotes: 1
Views: 6347
Reputation: 166
I follow Gord Thompson's advice in comments to question and printed the list of drivers on my system and resolved it by changing the driver from:
DRIVER={Microsoft Access Driver (*.mdb, *.accdb)}
to
DRIVER={Microsoft Access Driver (*.mdb)
Hope that help, Warren
Upvotes: 0