[gdal-dev] Oracle OCI connection in Python OGR
Eric Wolf
ebwolf at gmail.com
Fri Feb 12 04:18:23 EST 2010
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100212/8738972b/attachment.html
More information about the gdal-dev
mailing list