Im trying to connect to my microsoft access datbase stored locally on my PC using pythons pyodbc
but I keep getting a long error. Heres my code.
conn = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\Users\James\Documents\Database1.accdb;')
cursor = conn.cursor()
cursor.execute('select * my_table')
Heres the error , or part of:
Error: ('HY000', "[HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile) Ace DSN for process 0x2cd0 Thread 0x268c DBC 0x7f37e34 Jet'. (63) (SQLDriverConnect); [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile) Ace DSN for process 0x2cd0 Thread 0x268c DBC 0x7f37e34 Jet'. (63); [HY000] [Microsoft][ODBC Microsoft Access Driver] The database you are trying to open requires a newer version of Microsoft Access. (-1073); [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile) Ace DSN for process 0x2cd0 Thread 0x268c DBC 0x7f37e34 Jet'. (63); [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile) Ace DSN for process 0x2cd0 Thread 0x268c DBC 0x7f37e34 Jet'. (63); [HY000] [Microsoft][ODBC Microsoft Access Driver] The database you are trying to open requires a newer version of Microsoft Access. (-1073)")
using pyodbc.drivers()
, returns
so my understanding is that the driver Driver={Microsoft Access Driver (*.mdb, *.accdb
exists on my machine
Ive downloaded and installed Microsofts Access database engine but that didnt help.. I also changed my connection string to
DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};UID=admin;UserCommitSync=Yes;Threads=3;SafeTransactions=0;PageTimeout=5;MaxScanRows=8;MaxBufferSize=2048;{FIL=MS Access};DriverId=25;DefaultDir=C:\Users\James\Documents;DBQ=C:\Users\James\Documents\Database1.accdb
Error msg stayed the same
Any suggestions??