
August 23rd, 2012, 04:21 AM
|
|
Registered User
|
|
Join Date: Jul 2012
Posts: 12
Time spent in forums: 4 h 37 m 41 sec
Reputation Power: 0
|
|
|
Access DB 2007
Dear all,
I am facing some problems while accessing the AccessDB 2007 from pythonwin. Could you please help. Or also if you know any other way using win32com to access the access2007 db.
Version:
ActivePython 2.7.2.5 (ActiveState Software Inc.) based on
Python 2.7.2 (default, Jun 24 2011, 12:22:14) [MSC v.1500 64 bit (AMD64)] on win32
Operating System: Windows 7
Code:
try:
import sys
from win32com.client import Dispatch
except ImportError as e:
print e
sys.exit(1)
if __name__ == '__main__':
data_source = "C:\\temp\\Database1.accdb"
access = Dispatch('ADODB.Connection')
access.Open('PROVIDER=Microsoft.ACE.OLEDB.12.0;Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\\temp\\Database1.accdb;')
Error:
C:\> a_db.py
Traceback (most recent call last):
File "D:\Data\Python Scripts\For the heck of sharepoint\a_db.py", line 11, in <module>
access.Open('PROVIDER=Microsoft.ACE.OLEDB.12.0;Driver={Microsoft Access Driver (*.mdb, *.accdb)}
;DBQ=C:\\temp\\Database1.accdb;')
File "<COMObject ADODB.Connection>", line 3, in Open
File "C:\ActivePython27\lib\site-packages\win32com\client\dynamic.py", line 276, in _ApplyTypes_
result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags, retType, argTypes) + args)
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, u'ADODB.Connection', u'Provider canno
t be found. It may not be properly installed.', u'C:\\Windows\\HELP\\ADO270.CHM', 1240655, -21468245
82), None)
|