pyodbc.Error when trying to open jet database
I'm trying to read data stored in a ms access database that generated by a piece of software Hy Tek Meet Manager
import pyodbc
filename = 'db.mdb'
connection = pyodbc.connect('DRIVER={Microsoft Access Driver (*.mdb)};DBQ='+filename)
cursor = conn.cursor()
When I run this code I get the error:
开发者_StackOverflow中文版pyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnectW)')
All other searches for this error have led to dead ends. Any suggestions as to why this is happening?
Based on one of your comments it sounds like you are using the EasySoft MS Access ODBC drivers. Referencing their support page, I would guess the following is what you want to use for your connection string:
import pyodbc
filename = 'db.mdb'
connection = pyodbc.connect('DRIVER={Easysoft ODBC-ACCESS}; MDBFILE='+filename)
cursor = conn.cursor()
精彩评论