I'm getting an exception right from the start of trying to assign the driver. I've generated the DNS using 32 bit executable Odbcad32.exe in the SysWoW64 folder. I believe I created the driver string correctly (wrapped parentheses for spaces, semi colons at the ends, and dropped the first row), but no matter the tweaks I try I get this exception on the assignment of pyodbc.connect
. The .mdb file is local obviously.
Code:
import pyodbc
con = pyodbc.connect('DRIVER=(Driver do Microsoft Access (*.mdb));UID=admin;UserCommitSync=Yes;Threads=3;SafeTransactions=0;PageTimeout=5;MaxScanRows=8;MaxBufferSize=2048;FIL=(MS Access);DriverId=25;DefaultDir=C:\\Users\Mac2\Desktop\TLC_Program_Release\Scripts;DBQ=C:\\Users\Mac2\Desktop\TLC_Program_Release\Scripts\SetupSheets.mdb')
cursor = con.cursor()
cursor.execute('SELECT * FROM ProgramData')
for row in cursor.fetchall():
print(row)
Exception:
Exception has occurred: pyodbc.InterfaceError
('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')