[Qgis-user] Connect to ms access database via OLEDB

Randal Hale rjhale at northrivergeographic.com
Mon Apr 13 08:33:17 PDT 2015


I had to install: 
http://www.microsoft.com/en-us/download/details.aspx?id=13255 and then 
went through the ODBC Connection

Granted I did this on a windows laptop with no ArcGIS installed - which 
makes me wonder if it would be any different.....

I wrote it up a turorial: 
http://www.northrivergeographic.com/qgis-accessing-personal-geodatabase

Hope it helps or gets you pointed in the right direction!

Randy

On 04/13/2015 11:26 AM, John Barnes wrote:
>
> 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
>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user

-- 
-----------------
Randal Hale
North River Geographic Systems, Inc
http://www.northrivergeographic.com
423.653.3611 rjhale at northrivergeographic.com
twitter:rjhale     http://about.me/rjhale
http://www.northrivergeographic.com/introduction-to-quantum-gis

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20150413/85a4a95c/attachment.html>


More information about the Qgis-user mailing list