I'm working on a project that requires me to use an SQL database, and the software I have available to use is Microsoft Access. I've looked around various forums (including this one) for help with the connection between Python and Access, but my error is never resolved. Here's my code:
import pyodbc
connect = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:\\Users\\User\\Documents\\My Folder\\leaderboards.accdb;')
cursor = connect.cursor()
cursor.execute('select * from level1')
for row in cursor.fetchall():
print (row)
And the error I keep receiving is this:
connect = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=C:\\Users\\User\\Documents\\My Folder\\leaderboards.accdb;')
pyodbc.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')
I'm pretty new to using SQL stuff (I only know how to query the database, I've never integrated it with a separate program) so I don't know exactly where the error lies, and I'm not familiar with the format of such functions so I don't know what parts are placeholder and what are actual code.
I've tried reinstalling and updating drivers and I've made every amendment I can think of or find, but nothing changes, so there's obviously something fundamental I'm missing here.
How can this be solved?