问题描述
这里是我尝试过的:
- 通过搜索查找Vista的ODBC数据源管理器,
-Find Vista's ODBC Data Source Manager* through search,
- 添加新的文件数据源*,选择驱动程序为Microsoft Access(* .mdb),并选择我感兴趣的mdb文件,
-Add a new File Data Source*, selecting Driver for Microsoft Access (*.mdb), and selecting my mdb file of interest,
-import pyodbc从python shell并尝试:
-import pyodbc from python shell and try:
pyodbc.connect("DSN=<that Data Source I just created>")
我收到以下错误消息(葡萄牙语**):
I get the following error message (Portuguese**):
Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Nome da fonte de dados n\xe3o encontrado e nenhum driver padr\xe3o especificado (0) (SQLDriverConnectW)')
其中翻译为未找到数据源名称,
Which translates as "Data source name not found and no standard driver specified".
我做错了什么?
如何得到它?
此外,我在网上搜索文档,但发现没有什么值得的,任何人都可以推荐任何文档?
What am I doing wrong?How to get it right?Also, I searched the web for documentation but found nothing worth much, could anyone recommend any documentation?
*名称可能不完全准确,
*Names may not be completely accurate because my Windows is in Portuguese.
**不,葡萄牙语没有'3'和'\'作为字母,这些是错误打印的特殊字符
**No, Portuguese doesn't have '3' and '\' as letters, these are misprinted special characters
推荐答案
DSN =仅用于系统或用户DSN。
DSN= is only used for a system or user DSN.
您需要使用FILEDSN = c:\myDsnFile.dsn
For a DSN File, you need to use FILEDSN=c:\myDsnFile.dsn
是您最好的朋友。
这篇关于如何将pyodbc连接到Access(.mdb)数据库文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!