Maybe it's just me... but...<div><br></div><div>I'm trying to connect to another Oracle instance, on a different machine, using basically the same code as above. I get exactly the same results. In this case, I've tried Python 2.6.4 with GDAL 1.6.0 and Python 2.4.1 with GDAL 1.5.2. I can connect with OGR2OGR.EXE in the same environment but cannot connect with OGR. The Oracle instance is 11.2.0.1.0.</div>
<div><br></div><div>I'm probably going setup my own build environment for GDAL/OGR at home (on the same system as the Oracle install). So I may just roll my own and see if that helps. Although I wouldn't mind trying other's eggs.</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 10:43 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;">
Thanks Ivan,<div><br></div><div>NLS_LANGUAGE = AMERCAN</div><div><br></div><div>Reading shapefile works (still).</div><div><br></div><div>Rather aggravating... I may try it on another system to see what I get.</div><div><br>
</div><div>-Eric</div><div><br><div><div class="im">-=--=---=----=----=---=--=-=--=---=----=---=--=-=-<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></div>GPG Public Key: <a href="http://www.h4h.net/ebwolf.public.key.txt" target="_blank">http://www.h4h.net/ebwolf.public.key.txt</a><div><div></div><div class="h5"><br>
<br><br><div class="gmail_quote">On Mon, Feb 15, 2010 at 9:42 PM, Ivan Lucena <span dir="ltr"><<a href="mailto:ivan.lucena@pmldnet.com" target="_blank">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,<br>
<br>
Sorry for my typo. I mean, "it was a good clue".<br>
<br>
I did a quit test using GDAL 1.8dev, the trunk version. I build the python wrapper myself by running "setup.py bdist_wininst" with Python 2.5.4. That generates "GDAL-1.7.0.win32-py2.5.exe".<br>
<br>
That is how it goes:<br>
<br>
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32<br>
Type "help", "copyright", "credits" or "license" for more information.<br>
>>> from osgeo import ogr<br>
>>> ds = ogr.Open("OCI:scott/tiger@orcl")<br>
>>> ly = ds.GetLayer(0)<br>
>>> ly.GetName()<br>
'ROADS'<br>
>>><br>
<br>
No problem here.<br>
<br>
I believe that you should use a GDAL/Python wrapper compatible (UNICODE) with the Python you have.<br>
<br>
By the way, what is the character set of your database?<br>
<br>
select * from NLS_DATABASE_PARAMETERS;<br>
<br>
There is also the NLS_LANG. NLS_LANG is set as a local environment variable on UNIX and is set in the registry on Windows.<br>
<br>
I just following that clue, but can you use ogr.Open() with a local file, like a shape file?<br>
<br>
Best regards,<br>
<br>
Ivan<br>
<div><br>
<br>
<br>
<br>
> -------Original Message-------<br>
> From: Eric Wolf <<a href="mailto:ebwolf@gmail.com" target="_blank">ebwolf@gmail.com</a>><br>
> To: gdal-dev <<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>><br>
> Subject: Re: [gdal-dev] Oracle OCI connection in Python OGR<br>
> Sent: Feb 15 '10 17:47<br>
><br>
> I'm beginning to think something is wrong at my end. I just installed<br>
> Python 2.5, GDAL 1.5 and cx_Oracle for Python 2.5. I'm still getting<br>
> the same behavior. cx_Oracle works, OGR doesn't.<br>
><br>
><br>
> Is the clue in my last email? I mean, the Unicode version of cx_Oracle<br>
> didn't work but the non-Unicode version did work. Is the OGR OCI driver<br>
> compiled for Unicode?<br>
><br>
><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>
</div>> GPG Public Key: [LINK: <a href="http://www.h4h.net/ebwolf.public.key.txt" target="_blank">http://www.h4h.net/ebwolf.public.key.txt</a>]<br>
<div>> <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>> On Mon, Feb 15, 2010 at 3:33 PM, Ivan <[LINK:<br>
> mailto:<a href="mailto:ivan.lucena@pmldnet.com" target="_blank">ivan.lucena@pmldnet.com</a>] <a href="mailto:ivan.lucena@pmldnet.com" target="_blank">ivan.lucena@pmldnet.com</a>> wrote:<br>
> Eric,<br>
><br>
><br>
> Eric Wolf wrote:<br>
> 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<br>
> Unicode cx_Oracle 5.0.3. Switching to the non-Unicode cx_Oracle got it<br>
> working. But OGR is still not connecting.<br>
><br>
> Does OGR rely on cx_Oracle?<br>
><br>
> No it doesn't but I was a good to clue.<br>
><br>
><br>
> I think I'll try regressing to an older version of GDAL and see if it<br>
> works.<br>
><br>
> I running GDAL/OGR/Python/OCI on OpenSUSE and it works just fine. I am<br>
> going to test on Windows.<br>
><br>
> Regards,<br>
><br>
> Ivan<br>
><br>
><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>
</div>> GPG Public Key: [LINK: <a href="http://www.h4h.net/ebwolf.public.key.txt" target="_blank">http://www.h4h.net/ebwolf.public.key.txt</a>]<br>
<div>> <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>> On Sun, Feb 14, 2010 at 12:45 PM, Abhay <[LINK:<br>
> mailto:<a href="mailto:abhay.menon@gmail.com" target="_blank">abhay.menon@gmail.com</a>] <a href="mailto:abhay.menon@gmail.com" target="_blank">abhay.menon@gmail.com</a> <mailto:[LINK:<br>
> mailto:<a href="mailto:abhay.menon@gmail.com" target="_blank">abhay.menon@gmail.com</a>] <a href="mailto:abhay.menon@gmail.com" target="_blank">abhay.menon@gmail.com</a>>> wrote:<br>
><br>
><br>
> On Fri, Feb 12, 2010 at 11:32 PM, Eric Wolf <[LINK:<br>
> mailto:<a href="mailto:ebwolf@gmail.com" target="_blank">ebwolf@gmail.com</a>] <a href="mailto:ebwolf@gmail.com" target="_blank">ebwolf@gmail.com</a><br>
<div><div></div><div>><br>
> <mailto:[LINK: mailto:<a href="mailto:ebwolf@gmail.com" target="_blank">ebwolf@gmail.com</a>] <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<br>
> 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<br>
> 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<br>
> perfectly.<br>
><br>
> -Eric<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>
</div></div>> GPG Public Key: [LINK:<br>
> <a href="http://www.h4h.net/ebwolf.public.key.txt" target="_blank">http://www.h4h.net/ebwolf.public.key.txt</a>]<br>
<div>> <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>> On Fri, Feb 12, 2010 at 6:56 AM, Abhay <[LINK:<br>
> mailto:<a href="mailto:abhay.menon@gmail.com" target="_blank">abhay.menon@gmail.com</a>] <a href="mailto:abhay.menon@gmail.com" target="_blank">abhay.menon@gmail.com</a><br>
><br>
> <mailto:[LINK: mailto:<a href="mailto:abhay.menon@gmail.com" target="_blank">abhay.menon@gmail.com</a>]<br>
<div>> <a href="mailto:abhay.menon@gmail.com" target="_blank">abhay.menon@gmail.com</a>>> wrote:<br>
><br>
><br>
</div>> On Fri, Feb 12, 2010 at 2:48 PM, Eric Wolf <[LINK:<br>
> mailto:<a href="mailto:ebwolf@gmail.com" target="_blank">ebwolf@gmail.com</a>] <a href="mailto:ebwolf@gmail.com" target="_blank">ebwolf@gmail.com</a><br>
><br>
><br>
> <mailto:[LINK: mailto:<a href="mailto:ebwolf@gmail.com" target="_blank">ebwolf@gmail.com</a>]<br>
<div><div></div><div>> <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<br>
> 2.6.4-10 and<br>
> cx_Oracle-5.0.3-11g. I am trying to connect to an<br>
> Oracle<br>
> 11g instance.<br>
><br>
> This works:<br>
><br>
> ogr2ogr -f "KML" emp.kml OCI:scott/tiger<br>
> "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>
> Eric B. Wolf New!<br>
> 720-334-7734<br>
> USGS Geographer<br>
> Center of Excellence in GIScience<br>
> PhD Student<br>
> CU-Boulder - Geography<br>
><br>
</div></div>> GPG Public Key: [LINK:<br>
> <a href="http://www.h4h.net/ebwolf.public.key.txt" target="_blank">http://www.h4h.net/ebwolf.public.key.txt</a>]<br>
<div>> <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>> [LINK: mailto:<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>]<br>
> <a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a> <mailto:[LINK: mailto:<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>]<br>
<div>> <a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>><br>
><br>
</div>> [LINK:<br>
> <a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a>]<br>
<div><div></div><div>> <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<br>
> 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 a<br>
</div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>