Thread: [cx-oracle-users] "Unable to acquire Oracle environment handle" with cx_Oracle 4.1.2 oracle 10g
Brought to you by:
atuining
From: Oliver-Mark C. <oc...@as...> - 2006-01-16 18:09:01
|
Hi! I got the error message "Unable to acquire Oracle environment handle" and I'm a little bit puzzled that it is not functioning. The problem is NOT: - ORACLE_HOME - LD_LIBRARY_PATH - Debian Linux - TNS_ADMIN All necessary variables are set and working. With sqlplus I get the wanted connection to the database. The funny thing is that I get the error using the Oracle instant client or other client installation but not with an export of the full database installation I'm using on a different machine. The next thing I tried is to use the module compiled on a working environment which also fails (oracle library and linking were OK). Looking into the source code I found that "OCIEnvCreate" creates the error message. If I understand it correctly OCIEnvCreate has to be called before other Oracle function can be called right? So questions about a correct server,password etc as I found in the net are stupid ;-) I wrote a small C-Program and used the same compile options: /* small program */ #include <stdlib.h> #include <stdio.h> #include "oratypes.h" #include "ociap.h" int main( int argc, char *argv[] ) { OCIEnv *envhandle; sword status; ub4 mode; mode = OCI_OBJECT; envhandle = NULL; printf( "%i\n", mode ); mode = !OCI_THREADED; status = OCIEnvCreate( &envhandle, mode, NULL, NULL, NULL, NULL, 0, NULL ); printf( "%i\n", status ); if (!envhandle ) printf( "Unable to acquire Oracle environment handle!\n" ); else printf( "Success!\n" ); return 0; } /* end of small program */ This program works fine with my installation of the client! Btw, it is the recent client of the Oracle 10g distribution. Any suggestions? Thanks for help, Oliver PS: Sorry for my tone, but Oracle is driving me crazy. We have to use Oracle and cx_Oracle for an important project and my boss is pressing ... -- (O> (0- _o) -O) //\ //\ /\\ /\\ V_/_ V_/_ _\_V _\_V Dr. Oliver-M. Cordes E-Mail: oc...@as... Sternwarte der WWW-URL: http://www.astro.uni-bonn.de/~ocordes/ Universitaet Bonn Phone: (49) 228 / 73-5656 Auf dem Huegel 71 Fax: (49) 228 / 73-3672 D - 53121 Bonn Germany Private address: Witterschlickerstr. 22 , D - 53123 Bonn Private phone: (49) 228 / 7482582 |
From: Anthony T. <ant...@gm...> - 2006-01-16 18:33:39
|
This error occurs when the Oracle client that cx_Oracle was compiled with does not match the client that is currently in use. You have to make sure that these match. So perhaps you can give a little more information. What Oracle client are you using. Are you building your own cx_Oracle or using a precompiled one -- if so, which one. What are the values for ORACLE_HOME and LD_LIBRARY_PATH and where is your Oracle client installed. If you run "ldd cx_Oracle.so" what is the result? Specifically which libclntsh.so is it linked against? Hope this helps track it down. On 1/16/06, Oliver-Mark Cordes <oc...@as...> wrote: > Hi! > > I got the error message "Unable to acquire Oracle environment handle" and > I'm a little bit puzzled that it is not functioning. > > The problem is NOT: > - ORACLE_HOME > - LD_LIBRARY_PATH > - Debian Linux > - TNS_ADMIN > > All necessary variables are set and working. With sqlplus I get the wante= d > connection to the database. > > The funny thing is that I get the error using the Oracle instant client o= r > other client installation but not with an export of the full database > installation I'm using on a different machine. The next thing I tried is > to use the module compiled on a working environment which also fails > (oracle library and linking were OK). > > Looking into the source code I found that "OCIEnvCreate" creates the erro= r > message. If I understand it correctly OCIEnvCreate has to be called befor= e > other Oracle function can be called right? So questions about a correct > server,password etc as I found in the net are stupid ;-) I wrote a small > C-Program and used the same compile options: > > /* small program */ > #include <stdlib.h> > > #include <stdio.h> > > #include "oratypes.h" > > #include "ociap.h" > > int main( int argc, char *argv[] ) > { > OCIEnv *envhandle; > > sword status; > ub4 mode; > > mode =3D OCI_OBJECT; > envhandle =3D NULL; > > printf( "%i\n", mode ); > > mode =3D !OCI_THREADED; > > status =3D OCIEnvCreate( &envhandle, mode, NULL, NULL, NULL, NULL, 0, = NULL > ); > > printf( "%i\n", status ); > > if (!envhandle ) > printf( "Unable to acquire Oracle environment handle!\n" ); > else > printf( "Success!\n" ); > > return 0; > } > > > /* end of small program */ > > This program works fine with my installation of the client! Btw, it is th= e > recent client of the Oracle 10g distribution. > > > Any suggestions? > > > Thanks for help, > > Oliver > > > PS: Sorry for my tone, but Oracle is driving me crazy. We have to use > Oracle and cx_Oracle for an important project and my boss is pressing ... > > > > -- > (O> (0- _o) -O) > //\ //\ /\\ /\\ > V_/_ V_/_ _\_V _\_V > > Dr. Oliver-M. Cordes E-Mail: oc...@as... > Sternwarte der WWW-URL: http://www.astro.uni-bonn.de/~ocor= des/ > Universitaet Bonn Phone: (49) 228 / 73-5656 > Auf dem Huegel 71 Fax: (49) 228 / 73-3672 > D - 53121 Bonn Germany > > Private address: Witterschlickerstr. 22 , D - 53123 Bonn > Private phone: (49) 228 / 7482582 > > > ------------------------------------------------------- > 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://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |
From: Falko S. <Fal...@gm...> - 2006-01-16 19:10:21
|
On Mon, 16 Jan 2006 19:08:54 +0100 (CET) Oliver-Mark Cordes <oc...@as...> wrote: > Looking into the source code I found that "OCIEnvCreate" creates the error > message. ... ... > Any suggestions? I had the same problem (OCIEnvCreate failed) with a small OCI application. The reason was that oraInstaller set strange file and directory permissions in $ORACLE_HOME, e.g.: # ls -ld mesg drwxr-x--- 2 oracle10 users 144 Sep 14 18:47 mesg/ After fixing this ("chmod o+rx" for all directories, "chmod o+r" for all files in the $ORACLE_HOME subtree) all OCI applications are working as expected. HTH, Falko |
From: Oliver-Mark C. <oc...@as...> - 2006-01-16 19:10:37
|
On Mon, 16 Jan 2006, Anthony Tuininga wrote: > This error occurs when the Oracle client that cx_Oracle was compiled > with does not match the client that is currently in use. You have to > make sure that these match. So perhaps you can give a little more > information. What Oracle client are you using. Are you building your > own cx_Oracle or using a precompiled one -- if so, which one. What are > the values for ORACLE_HOME and LD_LIBRARY_PATH and where is your > Oracle client installed. If you run "ldd cx_Oracle.so" what is the > result? Specifically which libclntsh.so is it linked against? Hope > this helps track it down. > > [...] No, this does not help :-( I just found the the solution. In the ORACLE_HOME variable an ending "/" will cause the problem. LD_LIBRARY_PATH and ORACLE_HOME has indeed the same value, but somehow the Oracle libs don't link ending slashes ... Is there a possibility to check the environment valiables in cx_Oracle first? The would help to track down the problem! Best wishes, Oliver |
From: Anthony T. <ant...@gm...> - 2006-01-16 19:43:23
|
On 1/16/06, Oliver-Mark Cordes <oc...@as...> wrote: > On Mon, 16 Jan 2006, Anthony Tuininga wrote: > > > This error occurs when the Oracle client that cx_Oracle was compiled > > with does not match the client that is currently in use. You have to > > make sure that these match. So perhaps you can give a little more > > information. What Oracle client are you using. Are you building your > > own cx_Oracle or using a precompiled one -- if so, which one. What are > > the values for ORACLE_HOME and LD_LIBRARY_PATH and where is your > > Oracle client installed. If you run "ldd cx_Oracle.so" what is the > > result? Specifically which libclntsh.so is it linked against? Hope > > this helps track it down. > > > > > [...] > > No, this does not help :-( > > I just found the the solution. In the ORACLE_HOME variable an ending "/" > will cause the problem. LD_LIBRARY_PATH and ORACLE_HOME has indeed the > same value, but somehow the Oracle libs don't link ending slashes ... > > Is there a possibility to check the environment valiables in cx_Oracle > first? The would help to track down the problem! Glad to hear you got it sorted out. As for adding the check for the environment variables -- I'm sure it could be arranged but its not a very high priority for me since you're the first person that's actually ran into this problem in this particular way and this is clearly an Oracle problem. Now if you provide me a patch, of course.... :-) > Best wishes, > Oliver > > > > ------------------------------------------------------- > 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://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |