[Qgis-user] Connect to ms access database via OLEDB
John Barnes
John.Barnes at ci.mcminnville.or.us
Mon Apr 13 08:26:09 PDT 2015
QGIS 2.8.1
Windows 7 64bit
MS Office 2007 32bit
.NET Framework 4.5.2
Scrip Runner Version 2.0.1
Installed via standalone installer
Trying to connect to an access database via OLEDB. Tried this multiple ways, but I just can't get it to work. Error below says the Provider may not be properly installed, but I connect to the same access database through a vb.net addin in ArcMap with the same connection string (Microsoft.JET.OLEDB.4.0).
Any ideas?
Thanks,
John
==============my code======================================
import adodbapi
def run_script(iface):
cLayer = iface.activeLayer()
#print cLayer.name()
databasename = 'c:\\aab\\GISdb.mdb'
constr = 'Provider=Microsoft.JET.OLEDB.4.0;Data Source=%s' % databasename
db = adodbapi.connect(constr)
=============================================================
====================Error message==============================
----------2015-04-13 08:13:05.038000----------
Running db.py in: C:/Program Files/QGIS Wien/bin
Traceback (most recent call last):
File "C:/Users/barnesj/.qgis2/python/plugins\scriptrunner\scriptrunner.py", line 553, in run_script
user_script.run_script(self.iface)
File "C:\PROGRA~1\QGISWI~1\bin\db.py", line 11, in run_script
db = adodbapi.connect(constr)
File "C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\adodbapi\adodbapi.py", line 307, in connect
raise OperationalError(e, "Error opening connection: " + connection_string)
OperationalError: (com_error(-2147352567, 'Exception occurred.', (0, u'ADODB.Connection', u'Provider cannot be found. It may not be properly installed.', u'C:\\Windows\\HELP\\ADO270.CHM', 1240655, -2146824582), None), 'Error opening connection: Provider=Microsoft.JET.OLEDB.4.0;Data Source=c:\\aab\\GISdb.mdb;')
Abnormal termination
Completed script: db.py
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20150413/ed07a9d8/attachment.html>
More information about the Qgis-user
mailing list