<br><br><div class="gmail_quote">On Fri, Feb 12, 2010 at 2:48 PM, Eric Wolf <span dir="ltr"><<a href="mailto:ebwolf@gmail.com">ebwolf@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>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.</div><div><br></div>This works:<div><br></div><div> ogr2ogr -f "KML" emp.kml OCI:scott/tiger "EMP"</div>
<div><br></div><div>What am I doing wrong. This fails, ds is None:</div><div><br></div><div><div>from osgeo import ogr</div><div><br></div><div>try:</div><div> d = ogr.GetDriverByName('OCI')</div><div>except:</div>
<div> print "Unable to GetDriverByName"</div><div> quit()</div><div><br></div><div>ds = None</div><div><br></div><div>try:</div><div> ds = ogr.Open('OCI:scott/tiger')</div><div>except:</div><div>
print "Unable to open OCI connection"</div><div> quit()</div><div><br></div><div>if ds is None:</div><div> print "Unable to open Oracle connection", ds</div><div> quit()</div><div><br></div>
<div>lyr = ds.GetLayerByName('EMP')</div><div>number = lyr.GetFeatureCount()</div><div><br></div><div>print "Features: " + str(number)</div><div><br></div><div><br></div><div><br></div><div><br></div>-=--=---=----=----=---=--=-=--=---=----=---=--=-=-<br>
Eric B. Wolf New! 720-334-7734<br>USGS Geographer<br>Center of Excellence in GIScience<br>PhD Student <br>CU-Boulder - Geography<br><br>GPG Public Key: <a href="http://www.h4h.net/ebwolf.public.key.txt" target="_blank">http://www.h4h.net/ebwolf.public.key.txt</a><br>
</div>
<br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><div><br></div>Hi Eric,<div><br></div><div>Form your mail it not clear what is cause of the problem.</div>
<div><br></div><div>There 2 scenario here </div><div><br></div><div>1) you are on a remote machine form where your trying to connect oracle server machine:</div><div><br></div><div>a) Have you installed any Oracle Client in your system. Considering that you are using the complete oracle client installation you can use the following : </div>
<div>OCI:scott/tiger@<Tnsname entry for eg. ORCL></div><div><br></div><div>b) if you are trying out with Instant client for 11g you should try either of the following</div><div><br></div><div>OCI:scott/tiger@//localhost/<your ORACLE SERVICE IDENTIFIER for eg ORCL>.</div>
<div><br></div><div>2) you are on the oracle server machine where </div><div><br></div><div>you must set the oracle SID. like the following </div><div>on windows </div><div>SET ORACLE_SID=ORCL</div><div>or</div><div>on *nix</div>
<div>export ORACLE_SID=ORCL</div><div><br></div><div>then try your implementation or use methods stated in 1) </div><div><br></div><div><br></div><div><br></div><div><br></div><div>Rgds.</div><div><br></div><div>Abhay.</div>