Error in opening an Access database in python

时光怂恿深爱的人放手 提交于 2019-12-11 04:17:00

问题


I am a new to python programming and i want to write a python program to read and write data to and from the database.

The connection code is as follows:

DNS='catalog'
DRV = '{Microsoft Access Driver (*.mdb)}'
conn = pyodbc.connect('DRIVER=%s;DSN=%s;' % (DRV,DNS))

catalog is the DSN name.

I am am getting the following error:

Traceback (most recent call last):
File "C:\Python27\exampes\xxx.py", line 8, in <module>
conn = pyodbc.connect('DRIVER=%s;DSN=%s;' % (DRV,DNS))
Error: ('01000', "[01000] [Microsoft][ODBC Microsoft Access Driver]General Warning  Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x12b4 Thread 0x1544  DBC 0x567ea4 Jet'. (1) (SQLDriverConnect);
[01000] [Microsoft][ODBC Microsoft Access  Driver]General Warning Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x12b4 Thread 0x1544 DBC 0x567ea4 Jet'. (1)"

Can anyone please help me..?


回答1:


The account under which you are running is not an administrator. It needs registry access as per the message (also described here)

Registry access is needed to find the ODBC driver for MS Access.




回答2:


try to uncheck Attributes: Read-only box in file properties.



来源:https://stackoverflow.com/questions/11473737/error-in-opening-an-access-database-in-python

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