Board logo

标题: [问题求助] python 连接 access 出错 [打印本页]

作者: imbedinlove    时间: 2014-1-14 16:47     标题: python 连接 access 出错

大家好。
我使用的是 windows 7 x64 ,python33 x64, win32com x64
我在连接 access 数据库的时候总是报错:
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "<COMObject ADODB.Connection>", line 3, in Open
  File "D:\Python33\lib\site-packages\win32com\client\dynamic.py", line 282, in _ApplyTypes_
    result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags, retType, argTypes) + args)
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'ADODB.Connection', 'Provider cannot be found. It may not be properly installed.', 'C:\\Windows\\HELP\\ADO270.CHM', 1240655, -2146824582), None)

我的代码:
>>> import win32com.client
>>> import os,sys,string
>>> conn = win32com.client.Dispatch(r'ADODB.Connection')
>>> DSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=a.mdb;'
>>> conn.Open(DSN)
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "<COMObject ADODB.Connection>", line 3, in Open
  File "D:\Python33\lib\site-packages\win32com\client\dynamic.py", line 282, in _ApplyTypes_
    result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags, retType, argTypes) + args)
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'ADODB.Connection', 'Provider cannot be found. It may not be properly installed.', 'C:\\Windows\\HELP\\ADO270.CHM', 1240655, -2146824582), None)
>>> path = os.getcwd()
>>> print(path)
D:\Python33

什么原因呢? 难道是因为 64系统的原因?
望大家能帮忙解答一下,非常感谢




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2