在python中打开Access数据库时出错 [英] Error in opening an Access database in python

查看:264
本文介绍了在python中打开Access数据库时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个新的python编程,我想写一个python程序从数据库读取和写入数据。

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.

连接代码如下:

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


b $ b

目录是DSN名称。

catalog is the DSN name.

我收到以下错误:

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)"

任何人都可以帮助我。

推荐答案

您运行的帐户不是根据邮件需要注册表访问权限(也在此处描述

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

需要注册表访问才能找到MS Access的ODBC驱动程序。

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

这篇关于在python中打开Access数据库时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆