Using an Access database (.mdb) with Python on Ubuntu [duplicate]

爱⌒轻易说出口 提交于 2019-12-04 05:27:01

From what I know this driver "Microsoft Access Driver (*.mdb)" is only available on a Microsoft host, since you are on ubuntu, it won't work.

Mools Gang
import pyodbc 
DBfile = '/data/MSAccess/Music_Library.mdb'
conn = pyodbc.connect('DRIVER={Microsoft Access Driver (*.mdb)};DBQ='+DBfile)
cursor = conn.cursor()
SQL = 'SELECT Artist, AlbumName FROM RecordCollection ORDER BY Year;'

for row in cursor.execute(SQL): # cursors are iterable
print row.Artist, row.AlbumName

cursor.close()
conn.close()

There is The Official Example .. of use ...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!