Re: [cx-oracle-users] 4.1.2 install: Ubuntu Linux, Oracle 10.1.0.3 instant client problems
Brought to you by:
atuining
From: D.R. B. <da...@as...> - 2006-02-08 11:30:13
|
Hoi Chris, > 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. You can use something like the following in your program. import os if not os.environ.has_key('TNS_ADMIN'): os.environ['TNS_ADMIN'] =3D '/usr/lib/oracle/10.1.0.3/client' 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. Ciao, Danny 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 myself > with cx_Oracle. >=20 > 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 >=20 > I passed the web server the same env variables I have >=20 > 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 >=20 >=20 > Is there a way have a python program print out what tnsadmin.ora is looki= ng > 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. >=20 > Thanks, > Chris Poetzel >=20 >=20 > On 2/7/06 10:06 AM, "Anthony Tuininga" <ant...@gm...> wrote: >=20 > > 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 connect > > 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 generate > > the string that is normally found in a tnsnames.ora file and use that > > to connect. If you want to know which locations Oracle is searching > > for tnsnames.ora you can use the strace command -- there are several > > places. Hope this helps you track down the issue. > >=20 > > 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. I= ts a > >> > 64bit amd box. > >> > I have already installed the oracle 10.1.0.3 64 bit instant client. > >> > 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 libsqlplu= s.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 oci= ap.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 oci= apr.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-pro= totypes > >> > -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/pyt= hon2.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: warning: > >> 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: warnin= g: > >> > function declaration isn=C2=B9t a prototype > >> > /usr/lib/oracle/10.1.0.3/client/lib/sdk/include/ociap.h:9958: warnin= g: > >> > 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 argument 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 people hav= e 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 (0x00002aaaaab= c3000) > >> > libpthread.so.0 =3D> /lib/libpthread.so.0 (0x00002aaaaba7b00= 0) > >> > libc.so.6 =3D> /lib/libc.so.6 (0x00002aaaabb90000) > >> > libnnz10.so =3D> /usr/lib/oracle/10.1.0.3/client/lib/libnnz1= 0.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] File > >> > "/usr/lib/cgi-bin/cxOracle-test.py", line 10, in ? > >> > [Mon Feb 06 10:00:01 2006] [error] [client 146.137.1.33] connect= ion =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] Premature e= nd of > >> > script headers: cxOracle-test.py > >> > > >> > > >> > It appears that cx_oracle can not find the tns admin file whish I de= fined > >> in > >> > my environment. > >> > > >> > Thank you much, > >> > > >> > Chris Poetzel > >> > > >> > > >> > > >> > ------------------------------------------------------- > >> > This SF.net email is sponsored by: Splunk Inc. Do you grep through l= og > >> files > >> > for problems? Stop! Download the new AJAX search engine that makes > >> > searching your log files as easy as surfing the web. DOWNLOAD SPLU= NK! > >> > http://sel.as-us.falkag.net/sel?cmdlnk > >> <http://sel.as-us.falkag.net/sel?cmdlnk&kid> =103432&bid#0486&dat=1216= 42 > >> > _______________________________________________ > >> > 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 >=20 |