Eric, Sorry for my typo. I mean, "it was a good clue".
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". That is how it goes: Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from osgeo import ogr >>> ds = ogr.Open("OCI:scott/ti...@orcl") >>> ly = ds.GetLayer(0) >>> ly.GetName() 'ROADS' >>> No problem here. I believe that you should use a GDAL/Python wrapper compatible (UNICODE) with the Python you have. By the way, what is the character set of your database? select * from NLS_DATABASE_PARAMETERS; 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. I just following that clue, but can you use ogr.Open() with a local file, like a shape file? Best regards, Ivan > -------Original Message------- > From: Eric Wolf <ebw...@gmail.com> > To: gdal-dev <gdal-dev@lists.osgeo.org> > Subject: Re: [gdal-dev] Oracle OCI connection in Python OGR > Sent: Feb 15 '10 17:47 > > 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. > > > 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? > > > -Eric > > -=--=---=----=----=---=--=-=--=---=----=---=--=-=- > Eric B. Wolf New! 720-334-7734 > USGS Geographer > Center of Excellence in GIScience > PhD Student > CU-Boulder - Geography > > GPG Public Key: [LINK: http://www.h4h.net/ebwolf.public.key.txt] > http://www.h4h.net/ebwolf.public.key.txt > > > On Mon, Feb 15, 2010 at 3:33 PM, Ivan <[LINK: > mailto:ivan.luc...@pmldnet.com] ivan.luc...@pmldnet.com> wrote: > Eric, > > > Eric Wolf wrote: > I'm running Oracle 11g on the same machine as the Python script. > > 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. > > Does OGR rely on cx_Oracle? > > No it doesn't but I was a good to clue. > > > I think I'll try regressing to an older version of GDAL and see if it > works. > > I running GDAL/OGR/Python/OCI on OpenSUSE and it works just fine. I am > going to test on Windows. > > Regards, > > Ivan > > > -Eric > > -=--=---=----=----=---=--=-=--=---=----=---=--=-=- > Eric B. Wolf New! 720-334-7734 > USGS Geographer > Center of Excellence in GIScience > PhD Student > CU-Boulder - Geography > > GPG Public Key: [LINK: http://www.h4h.net/ebwolf.public.key.txt] > http://www.h4h.net/ebwolf.public.key.txt > > > On Sun, Feb 14, 2010 at 12:45 PM, Abhay <[LINK: > mailto:abhay.me...@gmail.com] abhay.me...@gmail.com <mailto:[LINK: > mailto:abhay.me...@gmail.com] abhay.me...@gmail.com>> wrote: > > > On Fri, Feb 12, 2010 at 11:32 PM, Eric Wolf <[LINK: > mailto:ebw...@gmail.com] ebw...@gmail.com > > <mailto:[LINK: mailto:ebw...@gmail.com] ebw...@gmail.com>> wrote: > > Thanks for the replies. Sorry I didn't give more details > on the > environment. > > I am running on Windows, at the command line, both ogr2ogr and > the python script. > > Created an environment variable for ORACLE_SID=ORCL > > I double-checked my OCI string by using sqlplus to connect: > > sqlplus scott/ti...@orcl > > This works fine. I changed the script to use that in the call > to > ogr.Open(). No luck. > > I imported gdal and sprinkled print 'Error:', > gdal.GetLastErrorMsg() in my exception handlers. I got: > > Unable to open Oracle connection None > Error: > > Still no dice. If I take the same script and modify the > GetDriverByName and Open to use a shapefile, it works > perfectly. > > -Eric > > > -=--=---=----=----=---=--=-=--=---=----=---=--=-=- > Eric B. Wolf New! 720-334-7734 > USGS Geographer > Center of Excellence in GIScience > PhD Student > CU-Boulder - Geography > > GPG Public Key: [LINK: > http://www.h4h.net/ebwolf.public.key.txt] > http://www.h4h.net/ebwolf.public.key.txt > > > On Fri, Feb 12, 2010 at 6:56 AM, Abhay <[LINK: > mailto:abhay.me...@gmail.com] abhay.me...@gmail.com > > <mailto:[LINK: mailto:abhay.me...@gmail.com] > abhay.me...@gmail.com>> wrote: > > > On Fri, Feb 12, 2010 at 2:48 PM, Eric Wolf <[LINK: > mailto:ebw...@gmail.com] ebw...@gmail.com > > > <mailto:[LINK: mailto:ebw...@gmail.com] > ebw...@gmail.com>> wrote: > > 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: [LINK: > http://www.h4h.net/ebwolf.public.key.txt] > http://www.h4h.net/ebwolf.public.key.txt > > _______________________________________________ > gdal-dev mailing list > [LINK: mailto:gdal-...@lists.osgeo.org] > gdal-dev@lists.osgeo.org <mailto:[LINK: mailto:gdal-...@lists.osgeo.org] > gdal-dev@lists.osgeo.org> > > [LINK: > http://lists.osgeo.org/mailman/listinfo/gdal-dev] > http://lists.osgeo.org/mailman/listinfo/gdal-dev > > > Hi Eric, > > Form your mail it not clear what is cause of the > problem. > > There 2 scenario here > 1) you are on a remote machine form where your trying to > connect oracle server machine: > > a) Have you installed any Oracle Client in your system. > Considering that you a _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev