<br><br><div class="gmail_quote">On Fri, Feb 12, 2010 at 11:32 PM, Eric Wolf <span dir="ltr"><<a href="mailto:ebwolf@gmail.com" target="_blank">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">
Thanks for the replies. Sorry I didn't give more details on the environment.<div><br></div><div>I am running on Windows, at the command line, both ogr2ogr and the python script.</div><div><br></div><div>Created an environment variable for ORACLE_SID=ORCL</div>
<div><br></div><div>I double-checked my OCI string by using sqlplus to connect:</div><div><br></div><div> sqlplus scott/tiger@orcl</div><div><br></div><div>This works fine. I changed the script to use that in the call to ogr.Open(). No luck.</div>
<div><br></div><div>I imported gdal and sprinkled print 'Error:', gdal.GetLastErrorMsg() in my exception handlers. I got:</div><div><br></div><div><div> Unable to open Oracle connection None</div><div> Error:</div>
<div><br></div><div>Still no dice. If I take the same script and modify the GetDriverByName and Open to use a shapefile, it works perfectly.</div><div><br></div><div>-Eric</div><div><br></div></div><div><br></div><div><div>
<br clear="all">
-=--=---=----=----=---=--=-=--=---=----=---=--=-=-<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>
<br><br></div><div><div></div><div><div class="gmail_quote">On Fri, Feb 12, 2010 at 6:56 AM, Abhay <span dir="ltr"><<a href="mailto:abhay.menon@gmail.com" target="_blank">abhay.menon@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br><br><div class="gmail_quote"><div><div></div><div>On Fri, Feb 12, 2010 at 2:48 PM, Eric Wolf <span dir="ltr"><<a href="mailto:ebwolf@gmail.com" target="_blank">ebwolf@gmail.com</a>></span> wrote:<br></div>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div>
<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></div></div>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">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><font color="#888888"><div>
Abhay.</div>
</font></blockquote></div><br></div></div></div>
<br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">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>What I still did not get is whether your running Oracle Server 11g on the same machine on which your developing. </div>
<div><br></div><div>Also have you tried connecting the same using "cx_Oracle.Connection" whether this connect string is working.</div><div><br></div><div>Are you using gdal-1.6.1-py2.6-win32.egg install with Python or build your on using SWIG python implementation.</div>
<div><br></div><div>Interestingly, what I found is that in gdal-1.6.1-py2.5-win32.egg which install using easy_install seem not work with OCI driver as way it should. But connection string using cx_Oracle is working. So it seem gdal-1.6.1-py*-win32.egg is broken for OCI plugin or probably it must be some setup I must have overlooked will setup, if someone else is working with same setup could help on this or Howard could comment on this. </div>
<div><br></div><div>I have build my own egg using latest repo of gdal build and is working. If you need I can share the same egg file (for python 2.6) or wait for Howard to compile for the latest build of GDAL-1.7 for python officially as you would need gdalwin32-17 for this along with OCI build plugin.</div>
<div><br></div><div>Rgds.</div><div><br></div><div>Abhay.</div>