Re: [cx-oracle-users] 4.1.2 install: Ubuntu Linux, Oracle 10.1.0.3 instant client problems
Brought to you by:
atuining
From: cpoetzel <cpo...@an...> - 2006-02-08 15:12:18
|
Danny, Thanks for the tip about sitecustomize.py. I did the following # more /usr/lib/python2.4/site-packages/sitecustomize.py import os os.environ['TNS_ADMIN'] =3D '/usr/lib/oracle/10.1.0.3/client'; Now my cx_Oracle through the web server is picking up the correct tnsadmin.ora file and is working correctly. Thanks for all the help everyone. Chris Poetzel On 2/8/06 5:29 AM, "D.R. Boxhoorn" <da...@as...> wrote: >=20 >=20 > Hoi Chris, >=20 >> > There are only a handfull of python scripts that use cx_Oracle through= the >> > web and if I have to statically set the env for TNS_ADMIN >> > I can live with that. I just don=E2=80=99t know how. >=20 > You can use something like the following in your program. >=20 > import os >=20 > if not os.environ.has_key('TNS_ADMIN'): > os.environ['TNS_ADMIN'] =3D '/usr/lib/oracle/10.1.0.3/client' >=20 > although I'm not completely sure whether that's what you mean. > We do this in the `sitecustomize.py' ourselves and that works just fine. > I think the client library will also look at $HOME/.tnsnames.ora, which > might work if your environment variables are stripped under suExec. >=20 > Ciao, >=20 > Danny >=20 >=20 > On Tue, Feb 07, 2006 at 03:00:24PM -0600, cpoetzel wrote: >> > Anthony, >> > Thanks for the response. >> > I was able to get a connection and response when using a script as mys= elf >> > with cx_Oracle. >> > >> > However, when I try to run the same script from the web server, I get = the >> > same error. >> > [Tue Feb 07 14:42:56 2006] [error] [client 146.137.1.33] ORA-12154: >> > TNS:could not resolve the connect identifier specified >> > >> > I passed the web server the same env variables I have >> > >> > Variable Value >> > LD_LIBRARY_PATH /usr/lib/oracle/10.1.0.3/client/lib >> > TNS_ADMIN /usr/lib/oracle/10.1.0.3/client >> > PATH /usr/local/bin:/usr/bin:/bin >> > PWD /etc/apache2 >> > LANG C >> > SHLVL 1 >> > ORACLE_HOME /usr/lib/oracle/10.1.0.3/client >> > _ /usr/sbin/apache2 >> > >> > >> > Is there a way have a python program print out what tnsadmin.ora is lo= oking >> > for when called from the web server? >> > There are only a handfull of python scripts that use cx_Oracle through= the >> > web and if I have to statically set the env for TNS_ADMIN >> > I can live with that. I just don=E2=80=99t know how. >> > >> > Thanks, >> > Chris Poetzel >> > >> > >> > On 2/7/06 10:06 AM, "Anthony Tuininga" <ant...@gm...> wr= ote: >> > >>> > > Its unfortunate that you don't have tnsping available as that tells >>> > > you whether or not the Oracle client can find the tnsnames.ora file >>> > > and whether it contains what you think it contains. :-) You do, >>> > > however, have SQL*Plus so you should first verify that you can conn= ect >>> > > using it with the same connect string you are using with cx_Oracle. >>> > > You can also make use of the cx_Oracle.make_dsn() method to generat= e >>> > > the string that is normally found in a tnsnames.ora file and use th= at >>> > > to connect. If you want to know which locations Oracle is searching >>> > > for tnsnames.ora you can use the strace command -- there are severa= l >>> > > places. Hope this helps you track down the issue. >>> > > >>> > > On 2/6/06, cpoetzel <cpo...@an...> wrote: >>>>> > >> > Hi, >>>>> > >> > I am trying to install cx_Oracle 4.1.2 on a new Ubuntu Breezy = Box. Its a >>>>> > >> > 64bit amd box. >>>>> > >> > I have already installed the oracle 10.1.0.3 64 bit instant cl= ient. >>>>> > >> > Install looks like this >>>>> > >> > >>>>> > >> > root@athena:/usr/lib/oracle/10.1.0.3/client# ls -R >>>>> > >> > .: >>>>> > >> > bin lib tnsnames.ora >>>>> > >> > >>>>> > >> > ./bin: >>>>> > >> > sqlplus >>>>> > >> > >>>>> > >> > ./lib: >>>>> > >> > classes12.jar glogin.sql libclntsh.so libclntsh.so.10.1 >>>>> libnnz10.so >>>>> > >> > libocci.so libocci.so.10.1 libociei.so libocijdbc10.so >>>>> libsqlplus.so >>>>> > >> > ojdbc14.jar sdk >>>>> > >> > >>>>> > >> > ./lib/sdk: >>>>> > >> > demo include >>>>> > >> > >>>>> > >> > ./lib/sdk/demo: >>>>> > >> > cdemo81.c demo.mk occidemod.sql occidemo.sql occidml.cpp >>>>> > >> > >>>>> > >> > ./lib/sdk/include: >>>>> > >> > nzerror.h occiAQ.h occiControl.h occi.h oci1.h >>>>> ociap.h >>>>> > >> > ocidef.h ocidfn.h oci.h ocixmldb.h oratypes.h ori.h = oro.h xa.h >>>>> > >> > nzt.h occiCommon.h occiData.h occiObjects.h oci8dp.= h >>>>> ociapr.h >>>>> > >> > ocidem.h ociextp.h ocikpr.h odci.h orid.h orl.h = ort.h >>>>> > >> > >>>>> > >> > >>>>> > >> > Env: >>>>> > >> > ORACLE_HOME=3D/usr/lib/oracle/10.1.0.3/client/lib >>>>> > >> > TNS_ADMIN=3D/usr/lib/oracle/10.1.0.3/client >>>>> > >> > LD_LIBRARY_PATH=3D/usr/lib/oracle/10.1.0.3/client/lib >>>>> > >> > >>>>> > >> > >>>>> > >> > Installing the client: >>>>> > >> > root@athena:/usr/local/build/Python-CxOracle/cx_Oracle-4.1.2# python >>>>> > >> > setup.py build >>>>> > >> > running build >>>>> > >> > running build_ext >>>>> > >> > building 'cx_Oracle' extension >>>>> > >> > creating build >>>>> > >> > creating build/temp.linux-x86_64-2.4 >>>>> > >> > gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall >>>>> -Wstrict-prototypes >>>>> > >> > -fPIC -I/usr/lib/oracle/10.1.0.3/client/lib/rdbms/demo >>>>> > >> > -I/usr/lib/oracle/10.1.0.3/client/lib/rdbms/public >>>>> > >> > -I/usr/lib/oracle/10.1.0.3/client/lib/network/public >>>>> > >> > -I/usr/lib/oracle/10.1.0.3/client/lib/sdk/include >>>>> -I/usr/include/python2.4 >>>>> > >> > -c cx_Oracle.c -o build/temp.linux-x86_64-2.4/cx_Oracle.o >>>>> > >> > -DBUILD_TIME=3D"February 06, 2006 10:21:45" >>>>> > >> > In file included from >>>>> > >> > /usr/lib/oracle/10.1.0.3/client/lib/sdk/include/oci.h:2327, >>>>> > >> > from cx_Oracle.c:9: >>>>> > >> > /usr/lib/oracle/10.1.0.3/client/lib/sdk/include/oci1.h:148: >>= >>> warning: >>>>> > >> > function declaration isn=C2=B9t a prototype >>>>> > >> > In file included from >>>>> > >> > /usr/lib/oracle/10.1.0.3/client/lib/sdk/include/ociap.h:206, >>>>> > >> > from >>>>> > >> > /usr/lib/oracle/10.1.0.3/client/lib/sdk/include/oci.h:2351, >>>>> > >> > from cx_Oracle.c:9: >>>>> > >> > /usr/lib/oracle/10.1.0.3/client/lib/sdk/include/nzt.h:674: war= ning: >>>> > >> function >>>>> > >> > declaration isn=C2=B9t a prototype >>>>> > >> > /usr/lib/oracle/10.1.0.3/client/lib/sdk/include/nzt.h:2665: >>= >>> warning: >>>>> > >> > function declaration isn=C2=B9t a prototype >>>>> > >> > /usr/lib/oracle/10.1.0.3/client/lib/sdk/include/nzt.h:2674: >>= >>> warning: >>>>> > >> > function declaration isn=C2=B9t a prototype >>>>> > >> > /usr/lib/oracle/10.1.0.3/client/lib/sdk/include/nzt.h:2684: >>= >>> warning: >>>>> > >> > function declaration isn=C2=B9t a prototype >>>>> > >> > /usr/lib/oracle/10.1.0.3/client/lib/sdk/include/nzt.h:2693: >>= >>> warning: >>>>> > >> > function declaration isn=C2=B9t a prototype >>>>> > >> > /usr/lib/oracle/10.1.0.3/client/lib/sdk/include/nzt.h:2702: >>= >>> warning: >>>>> > >> > function declaration isn=C2=B9t a prototype >>>>> > >> > /usr/lib/oracle/10.1.0.3/client/lib/sdk/include/nzt.h:2711: >>= >>> warning: >>>>> > >> > function declaration isn=C2=B9t a prototype >>>>> > >> > /usr/lib/oracle/10.1.0.3/client/lib/sdk/include/nzt.h:2719: >>= >>> warning: >>>>> > >> > function declaration isn=C2=B9t a prototype >>>>> > >> > /usr/lib/oracle/10.1.0.3/client/lib/sdk/include/nzt.h:2729: >>= >>> warning: >>>>> > >> > function declaration isn=C2=B9t a prototype >>>>> > >> > /usr/lib/oracle/10.1.0.3/client/lib/sdk/include/nzt.h:2736: >>= >>> warning: >>>>> > >> > function declaration isn=C2=B9t a prototype >>>>> > >> > /usr/lib/oracle/10.1.0.3/client/lib/sdk/include/nzt.h:2744: >>= >>> warning: >>>>> > >> > function declaration isn=C2=B9t a prototype >>>>> > >> > In file included from >>>>> > >> > /usr/lib/oracle/10.1.0.3/client/lib/sdk/include/oci.h:2351, >>>>> > >> > from cx_Oracle.c:9: >>>>> > >> > /usr/lib/oracle/10.1.0.3/client/lib/sdk/include/ociap.h:9952: = >>>>> warning: >>>>> > >> > function declaration isn=C2=B9t a prototype >>>>> > >> > /usr/lib/oracle/10.1.0.3/client/lib/sdk/include/ociap.h:9958: = >>>>> warning: >>>>> > >> > function declaration isn=C2=B9t a prototype >>>>> > >> > In file included from SessionPool.c:134, >>>>> > >> > from cx_Oracle.c:76: >>>>> > >> > Connection.c: In function =C5=92Connection_Acquire=C2=B9: >>>>> > >> > Connection.c:184: warning: pointer targets in passing argument= 5 of >>>>> > >> > =C5=92OCISessionGet=C2=B9 differ in signedness >>>>> > >> > In file included from Variable.c:89, >>>>> > >> > from Cursor.c:211, >>>>> > >> > from Connection.c:354, >>>>> > >> > from SessionPool.c:134, >>>>> > >> > from cx_Oracle.c:76: >>>>> > >> > NumberVar.c: In function =C5=92NumberVar_SetValue=C2=B9: >>>>> > >> > NumberVar.c:178: warning: pointer targets in passing argument = 2 of >>>>> > >> > =C5=92OCINumberFromText=C2=B9 differ in signedness >>>>> > >> > NumberVar.c:178: warning: pointer targets in passing argument = 4 of >>>>> > >> > =C5=92OCINumberFromText=C2=B9 differ in signedness >>>>> > >> > In file included from Variable.c:93, >>>>> > >> > from Cursor.c:211, >>>>> > >> > from Connection.c:354, >>>>> > >> > from SessionPool.c:134, >>>>> > >> > from cx_Oracle.c:76: >>>>> > >> > DateTimeVar.c: In function =C5=92DateTimeVar_SetValue=C2=B9: >>>>> > >> > DateTimeVar.c:81: warning: unused variable =C5=92status=C2=B9 >>>>> > >> > In file included from cx_Oracle.c:76: >>>>> > >> > SessionPool.c: In function =C5=92SessionPool_Init=C2=B9: >>>>> > >> > SessionPool.c:246: warning: pointer targets in passing argumen= t 6 of >>>>> > >> > =C5=92OCISessionPoolCreate=C2=B9 differ in signedness >>>>> > >> > creating build/lib.linux-x86_64-2.4 >>>>> > >> > gcc -pthread -shared build/temp.linux-x86_64-2.4/cx_Oracle.o >>>>> > >> > -L/usr/lib/oracle/10.1.0.3/client/lib/lib >>>>> > >> > -L/usr/lib/oracle/10.1.0.3/client/lib -lclntsh -o >>>>> > >> > build/lib.linux-x86_64-2.4/cx_Oracle.so -s >>>>> > >> > root@athena:/usr/local/build/Python-CxOracle/cx_Oracle-4.1.2# python >>>>> > >> > setup.py install >>>>> > >> > running install >>>>> > >> > running build >>>>> > >> > running build_ext >>>>> > >> > running install_lib >>>>> > >> > copying build/lib.linux-x86_64-2.4/cx_Oracle.so -> >>>>> > >> > /usr/lib/python2.4/site-packages >>>>> > >> > >>>>> > >> > Not sure if these warnings are normal but have seen other peop= le >>>>> have them >>>>> > >> > in the postings. >>>>> > >> > >>>>> > >> > >>>>> > >> > >>>>> > >> > root@athena:/tmp# ldd >>>>> /usr/lib/python2.4/site-packages/cx_Oracle.so >>>>> > >> > libclntsh.so.10.1 =3D> >>>>> > >> > /usr/lib/oracle/10.1.0.3/client/lib/libclntsh.so.10.1 >>>>> (0x00002aaaaabc3000) >>>>> > >> > libpthread.so.0 =3D> /lib/libpthread.so.0 >>>>> (0x00002aaaaba7b000) >>>>> > >> > libc.so.6 =3D> /lib/libc.so.6 (0x00002aaaabb90000) >>>>> > >> > libnnz10.so =3D> >>>>> /usr/lib/oracle/10.1.0.3/client/lib/libnnz10.so >>>>> > >> > (0x00002aaaabdc7000) >>>>> > >> > libdl.so.2 =3D> /lib/libdl.so.2 (0x00002aaaac038000) >>>>> > >> > libm.so.6 =3D> /lib/libm.so.6 (0x00002aaaac13a000) >>>>> > >> > libnsl.so.1 =3D> /lib/libnsl.so.1 (0x00002aaaac2bf000) >>>>> > >> > /lib64/ld-linux-x86-64.so.2 (0x0000555555554000) >>>>> > >> > >>>>> > >> > >>>>> > >> > I get the following error when trying to run a script >>>>> > >> > >>>>> > >> > [Mon Feb 06 10:00:01 2006] [error] [client 146.137.1.33] Fil= e >>>>> > >> > "/usr/lib/cgi-bin/cxOracle-test.py", line 10, in ? >>>>> > >> > [Mon Feb 06 10:00:01 2006] [error] [client 146.137.1.33] >>>>> connection =3D >>>>> > >> > cx_Oracle.connect("ectuser", "xxxxxx", "ect1"); >>>>> > >> > [Mon Feb 06 10:00:01 2006] [error] [client 146.137.1.33] >>>>> > >> > cx_Oracle.DatabaseError: ORA-12154: TNS:could not resolve the = >>>>> connect >>>>> > >> > identifier specified >>>>> > >> > [Mon Feb 06 10:00:01 2006] [error] [client 146.137.1.33] >>>>> > >> > [Mon Feb 06 10:00:01 2006] [error] [client 146.137.1.33] Prema= ture end of >>>>> > >> > script headers: cxOracle-test.py >>>>> > >> > >>>>> > >> > >>>>> > >> > It appears that cx_oracle can not find the tns admin file whis= h I >>>>> defined >>>> > >> in >>>>> > >> > my environment. >>>>> > >> > >>>>> > >> > Thank you much, >>>>> > >> > >>>>> > >> > Chris Poetzel >>>>> > >> > >>>>> > >> > >>>>> > >> > >>>>> > >> > ------------------------------------------------------- >>>>> > >> > This SF.net email is sponsored by: Splunk Inc. Do you grep thr= ough log >>>> > >> files >>>>> > >> > for problems? Stop! Download the new AJAX search engine that makes >>>>> > >> > searching your log files as easy as surfing the web. DOWNLOA= D >>>>> SPLUNK! >>>>> > >> > http://sel.as-us.falkag.net/sel?cmdlnk >>>> > >> <http://sel.as-us.falkag.net/sel?cmdlnk >>>> <http://sel.as-us.falkag.net/sel?cmdlnk&kid> >>>> <http://sel.as-us.falkag.net/sel?cmdlnk > > =103432&bid#0486&dat=121642 >>>>> > >> > _______________________________________________ >>>>> > >> > cx-oracle-users mailing list >>>>> > >> > cx-...@li... >>>>> > >> > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>>> > >> > >>> > > NH=C2=B5=C5=A0=C2=B2=C2=B2u=C2=A6=C2=90=0E=C2=BA=C2=A6=C2=A2=E2=80=93=C5=A0~=C2=AEz=C2=B6=C2=A3=C2=A1=E2=80=A6=C3=80^=C2=AD=C5=BEz=C2=B6zj=C5=A0=C2=A2=C2=A2=E2=80=A2=C2=B1=C3=89=C2=BA= =C5=BE{=0C,H4=C2=B6=C2=B1=C2=B2j=E2=80=9A=C3=BE >>> > > >> > >> > >=20 >=20 > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi= les > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=3Dk > <http://sel.as-us.falkag.net/sel?cmd=3Dk&kid> =103432&bid#0486&dat=121642 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >=20 |