[gdal-dev] Oracle OCI connection in Python OGR
Alan Boudreault
aboudreault at mapgears.com
Fri Feb 12 08:25:35 EST 2010
Eric,
Could you try a OCI connection string like:
"OCI:user/password at host/SID"
Alan
On February 12, 2010 04:18:23 am Eric Wolf wrote:
> I'm using GDAL/OGR 1.6.1 with ActivePython 2.6.4-10 and
> cx_Oracle-5.0.3-11g. I am trying to connect to an Oracle 11g instance.
>
> This works:
>
> ogr2ogr -f "KML" emp.kml OCI:scott/tiger "EMP"
>
> What am I doing wrong. This fails, ds is None:
>
> from osgeo import ogr
>
> try:
> d = ogr.GetDriverByName('OCI')
> except:
> print "Unable to GetDriverByName"
> quit()
>
> ds = None
>
> try:
> ds = ogr.Open('OCI:scott/tiger')
> except:
> print "Unable to open OCI connection"
> quit()
>
> if ds is None:
> print "Unable to open Oracle connection", ds
> quit()
>
> lyr = ds.GetLayerByName('EMP')
> number = lyr.GetFeatureCount()
>
> print "Features: " + str(number)
>
>
>
>
> -=--=---=----=----=---=--=-=--=---=----=---=--=-=-
> Eric B. Wolf New! 720-334-7734
> USGS Geographer
> Center of Excellence in GIScience
> PhD Student
> CU-Boulder - Geography
>
> GPG Public Key: http://www.h4h.net/ebwolf.public.key.txt
>
--
Alan Boudreault
Mapgears
http://www.mapgears.com
More information about the gdal-dev
mailing list