I'm beginning to think something is wrong at my end. I just installed Python 2.5, GDAL 1.5 and cx_Oracle for Python 2.5. I'm still getting the same behavior. cx_Oracle works, OGR doesn't.<div><br></div><div>Is the clue in my last email? I mean, the Unicode version of cx_Oracle didn't work but the non-Unicode version did work. Is the OGR OCI driver compiled for Unicode?</div>
<div><br></div><div>-Eric</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">http://www.h4h.net/ebwolf.public.key.txt</a><br>
<br><br><div class="gmail_quote">On Mon, Feb 15, 2010 at 3:33 PM, Ivan <span dir="ltr"><<a href="mailto:ivan.lucena@pmldnet.com">ivan.lucena@pmldnet.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Eric,<div class="im"><br>
<br>
Eric Wolf wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm running Oracle 11g on the same machine as the Python script.<br>
<br>
I did test cx_Oracle and found that it wasn't working. I was using the Unicode cx_Oracle 5.0.3. Switching to the non-Unicode cx_Oracle got it working. But OGR is still not connecting.<br>
<br>
Does OGR rely on cx_Oracle?<br>
</blockquote>
<br></div>
No it doesn't but I was a good to clue.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I think I'll try regressing to an older version of GDAL and see if it works.<br>
</blockquote>
<br></div>
I running GDAL/OGR/Python/OCI on OpenSUSE and it works just fine. I am going to test on Windows.<br>
<br>
Regards,<br>
<br>
Ivan<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
-Eric<br>
<br>
-=--=---=----=----=---=--=-=--=---=----=---=--=-=-<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 class="im">
On Sun, Feb 14, 2010 at 12:45 PM, Abhay <<a href="mailto:abhay.menon@gmail.com" target="_blank">abhay.menon@gmail.com</a> <mailto:<a href="mailto:abhay.menon@gmail.com" target="_blank">abhay.menon@gmail.com</a>>> wrote:<br>
<br>
<br>
<br>
On Fri, Feb 12, 2010 at 11:32 PM, Eric Wolf <<a href="mailto:ebwolf@gmail.com" target="_blank">ebwolf@gmail.com</a><br></div><div class="im">
<mailto:<a href="mailto:ebwolf@gmail.com" target="_blank">ebwolf@gmail.com</a>>> wrote:<br>
<br>
Thanks for the replies. Sorry I didn't give more details on the<br>
environment.<br>
<br>
I am running on Windows, at the command line, both ogr2ogr and<br>
the python script.<br>
<br>
Created an environment variable for ORACLE_SID=ORCL<br>
<br>
I double-checked my OCI string by using sqlplus to connect:<br>
<br>
sqlplus scott/tiger@orcl<br>
<br>
This works fine. I changed the script to use that in the call to<br>
ogr.Open(). No luck.<br>
<br>
I imported gdal and sprinkled print 'Error:',<br>
gdal.GetLastErrorMsg() in my exception handlers. I got:<br>
<br>
Unable to open Oracle connection None<br>
Error:<br>
<br>
Still no dice. If I take the same script and modify the<br>
GetDriverByName and Open to use a shapefile, it works perfectly.<br>
<br>
-Eric<br>
<br>
<br>
<br>
-=--=---=----=----=---=--=-=--=---=----=---=--=-=-<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>
On Fri, Feb 12, 2010 at 6:56 AM, Abhay <<a href="mailto:abhay.menon@gmail.com" target="_blank">abhay.menon@gmail.com</a><br></div><div class="im">
<mailto:<a href="mailto:abhay.menon@gmail.com" target="_blank">abhay.menon@gmail.com</a>>> wrote:<br>
<br>
<br>
<br>
On Fri, Feb 12, 2010 at 2:48 PM, Eric Wolf <<a href="mailto:ebwolf@gmail.com" target="_blank">ebwolf@gmail.com</a><br></div><div><div></div><div class="h5">
<mailto:<a href="mailto:ebwolf@gmail.com" target="_blank">ebwolf@gmail.com</a>>> wrote:<br>
<br>
I'm using GDAL/OGR 1.6.1 with ActivePython 2.6.4-10 and<br>
cx_Oracle-5.0.3-11g. I am trying to connect to an Oracle<br>
11g instance.<br>
<br>
This works:<br>
<br>
ogr2ogr -f "KML" emp.kml OCI:scott/tiger "EMP"<br>
<br>
What am I doing wrong. This fails, ds is None:<br>
<br>
from osgeo import ogr<br>
<br>
try:<br>
d = ogr.GetDriverByName('OCI')<br>
except:<br>
print "Unable to GetDriverByName"<br>
quit()<br>
<br>
ds = None<br>
<br>
try:<br>
ds = ogr.Open('OCI:scott/tiger')<br>
except:<br>
print "Unable to open OCI connection"<br>
quit()<br>
<br>
if ds is None:<br>
print "Unable to open Oracle connection", ds<br>
quit()<br>
<br>
lyr = ds.GetLayerByName('EMP')<br>
number = lyr.GetFeatureCount()<br>
<br>
print "Features: " + str(number)<br>
<br>
<br>
<br>
<br>
-=--=---=----=----=---=--=-=--=---=----=---=--=-=-<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>
gdal-dev mailing list<br></div></div>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a> <mailto:<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>><div class="im">
<br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
<br>
<br>
Hi Eric,<br>
<br>
Form your mail it not clear what is cause of the problem.<br>
<br>
There 2 scenario here <br>
1) you are on a remote machine form where your trying to<br>
connect oracle server machine:<br>
<br>
a) Have you installed any Oracle Client in your system.<br>
Considering that you are using the complete oracle client<br>
installation you can use the following : OCI:scott/tiger@<Tnsname entry for eg. ORCL><br>
<br>
b) if you are trying out with Instant client for 11g you<br>
should try either of the following<br>
<br>
OCI:scott/tiger@//localhost/<your ORACLE SERVICE IDENTIFIER<br>
for eg ORCL>.<br>
<br>
2) you are on the oracle server machine where <br>
you must set the oracle SID. like the following on windows SET ORACLE_SID=ORCL<br>
or<br>
on *nix<br>
export ORACLE_SID=ORCL<br>
<br>
then try your implementation or use methods stated in 1) <br>
<br>
<br>
<br>
Rgds.<br>
<br>
Abhay.<br>
<br>
<br>
<br>
_______________________________________________<br>
gdal-dev mailing list<br></div>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a> <mailto:<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>><div class="im"><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
<br>
<br>
Hi Eric,<br>
<br>
What I still did not get is whether your running Oracle Server 11g<br>
on the same machine on which your developing. <br>
Also have you tried connecting the same using "cx_Oracle.Connection"<br>
whether this connect string is working.<br>
<br>
Are you using gdal-1.6.1-py2.6-win32.egg install with Python or<br>
build your on using SWIG python implementation.<br>
<br>
Interestingly, what I found is that in gdal-1.6.1-py2.5-win32.egg<br>
which install using easy_install seem not work with OCI driver as<br>
way it should. But connection string using cx_Oracle is working. So<br>
it seem gdal-1.6.1-py*-win32.egg is broken for OCI plugin or<br>
probably it must be some setup I must have overlooked will setup, if<br>
someone else is working with same setup could help on this or Howard<br>
could comment on this. <br>
I have build my own egg using latest repo of gdal build and is<br>
working. If you need I can share the same egg file (for python 2.6)<br>
or wait for Howard to compile for the latest build of GDAL-1.7 for<br>
python officially as you would need gdalwin32-17 for this along with<br>
OCI build plugin.<br>
<br>
Rgds.<br>
<br>
Abhay.<br>
<br>
<br>
<br></div>
------------------------------------------------------------------------<div class="im"><br>
<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>
</div></blockquote>
<br>
</blockquote></div><br></div>