Problems with OCI without an environment (ORACLE_HOME not set)
System: Solaris 9, Sun-Fire-V440
Our application has Oracle 9i as one of the possible persistence backends. Oracle is not always available at all clients sites so we use dlopen/dlsym to access the required OCI functions in clntsh on demand. Moreover, the app is started by inetd, so there is no environment and ORACLE_HOME is not set. The result is that OCIEnvCreate fails and returns -1. Presumably libclntsh.so.9.0 looks for ORACLE_HOME and falls over when it doesn't find it.
Q: Is there a work around for this purely in terms of 9i version software?
One work around we've found is to install Instant Client. IC is intended to run in cases where there is no ORACLE_HOME set. This now acts as a gateway between our app and 9i. However, in order to make our app work with IC we've had to 'crle' the install path of IC. This is not so desirable because it adds to the admin burden.
Q. If the answer to the first question is 'no', is there another way of connecting to Oracle without modifying lib search paths?
I am including skeleton.cpp and the corresponding skeleton.ksh which demonstrates the problem.
Any advice is very much appreciated.
Adam
############## skeleton.cpp ########################
#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
#include <link.h>
#include <oci.h>
#include <oratypes.h>
int main(int argc, char *argv[])
OCIEnv *envhp;
sword (*MY_OCIEnvCreate)(...);
char* dlerr;
sword ociret;
if(argc < 1)
exit(1);
char dllname = (char )argv[1];
void *mydll = dlopen(dllname,RTLD_NOW|RTLD_GLOBAL);
if (mydll==NULL)
fprintf(stderr,"Error while loading Oracle module. dlopen() failed.\n"
"OS says: %s.\n",
(dlerr=dlerror())?dlerr:"");
exit(1);
MY_OCIEnvCreate = (sword(*)(...)) dlsym(mydll,"OCIEnvCreate");
if (MY_OCIEnvCreate == NULL)
fprintf(stderr,"Error while loading Oracle module function %s.\n"
"OS says: %s.\n",
"OCIEnvCreate",
(dlerr=dlerror())?dlerr:"");
exit(1);
ociret = MY_OCIEnvCreate(&envhp, OCI_DEFAULT, (dvoid *)0,
0, 0, 0, (size_t)0, (dvoid **)0);
if (OCI_SUCCESS != ociret)
fprintf(stderr, "OCI Error %ld occurred.\n", ociret);
exit(1);
return 0;
########### skeleton.ksh #####################
#!/bin/ksh -vx
ORA_DIR=/usr/opt/oracle/product/9.2.0.1.0
INSTCLI_DIR=/d0/adam/instantclient/instantclient10_1
# Make with 9i libs
CC -ldl -I$ORA_DIR/rdbms/demo -I$ORA_DIR/rdbms/public -o skeleton skeleton.cpp
if [[ $? -ne 0 ]]; then
print "ERROR: compile 1 failed"
exit 1
fi
# expect to succeed with ORACLE_HOME set and fail with ORACLE_HOME unset
export ORACLE_HOME=$ORA_DIR
skeleton $ORA_DIR/lib32/libclntsh.so
if [[ $? -ne 0 ]]; then
print "ERROR: unexpectedly failed in 9i on ORACLE_HOME set"
exit 1
fi
unset ORACLE_HOME
skeleton $ORA_DIR/lib32/libclntsh.so
if [[ $? -eq 0 ]]; then
print "ERROR: unexpectedly succeeded in 9i on ORACLE_HOME set"
exit 1
fi
# Make with Instance Client libs
CC -ldl -I$ORA_DIR/rdbms/demo -I$ORA_DIR/rdbms/public -o skeleton skeleton.cpp
if [[ $? -ne 0 ]]; then
print "ERROR: compile 2 failed"
exit 1
fi
# expect to succeed with ORACLE_HOME unset
skeleton $INSTCLI_DIR/libclntsh.so
if [[ $? -ne 0 ]]; then
print "ERROR: unexpectedly failed with Instance Client 10.1 and ORACLE_HOME set"
exit 1
fi
exit 0
############################################
After some investigation I have found a surprisingly simple solution to this problem. When inetd exec's a process, it provides a bare bones environment that comes from the /etc/default/login file. This environment can be extended using putenv(3C). Thus after dlopen/dlsym of clntsh, the program calls putenv with "ORACLE_HOME=/usr/opt/oracle/product/9.2.0.1.0" as argument. OCIEnvCreate and other OCI calls work fine after this.
Adam
Similar Messages
-
I have a MacBook Pro that I bought almost a year ago, next day problems with the hard disc that could not be diagnosed by the service, after 3 months they realized it and changed it with a new one, after 3-4 months heated and shut down by itself and dont work anymore. From apple say even a year has not passed it is not under garancy and I should pay to fix it without ans issue.
I have a MacBook Pro that I bought almost a year ago, next day problems with the hard disc that could not be diagnosed by the service, after 3 months they realized it and changed it with a new one, after 3-4 months heated and shut down by itself and dont work anymore. From apple say even a year has not passed it is not under garancy and I should pay to fix it without ans issue.
-
Hi ...
I have a problem with my ipod touch:
I can not activate my ipod with my Apple ID, it tells me that my account can not activate this device, but my apple ID is OK.
The proposed me as ipod help entering previous credentials, but the ipod is mine from the beginning, in fact I have my ballot, not bought down to another user.
Actually I do not know how to activate it in Chile were unable Store MacOnline solve my problem, it is for this reason that I am writing to see if someone can help me.
PLEAAASEEE
Thank you.
SebastianThanks for your answer.
actually, my ipod will not let me activate it with apple id, this happened when the new iOS acutalizó understand that has more security, but do not know what to do. -
when i try to update my itunes on my pc i keep getting the messaage that there was a problem with the installer and it could not finish. how do i fix this? i`ve tried to download 3 times already.
Hi
I've got a similar problem. iTunes v10.2 worked fine, but when I tried to update it to 10.5 I got a 'Bonjour' error. I eventually solved that but I still couldn't upgrade to 10.5, so I deleted every single Apple, Quicktime, iTunes, etc file on my PC using Revo Unistaller (because the normal Windows Add/Delete programs wouldn't work) but now, when I install the latest iTunes version from scratch (on XP SP3), it says: "the installer encountered errors before it could be configured.... your system has not been modified"
Any ideas?
Rick -
I have a problem with my ipod touch it does not light at all, what should I do?
I have a problem with my ipod touch it does not light at all, what should I do?
Try the troubleshooting here for your specific symptom:
iPod touch: Hardware troubleshooting -
There is a problem with my apple watch.it is not working well .There is a problem in its charging .The repairers says that contact to your company and ask them to provide you its software.
Please help me.Please be aware that you are not communicating with Apple when you post in these forums. These are user-to-user support forums, so in almost all cases the only people who will reply to your posts are, like me, your fellow users.
As to your issue, Apple does not and never has made a wristwatch as such. The only thing close to a watch that they have made was the 6th-generation iPod nano:
http://support.apple.com/kb/ht1353#iPod_Nano_6G
which has a clock feature and which some people have worn as a wristwatch. Is that what you mean?
Message was edited by: varjak paw -
i have problem with Cellular data network it is not apearing in iphone setting so help me how to bring this option in iphone
What brand/model USB drive? Is it bus or AC powered?
On Mail...
First Quit Mail, then I'd backup these two Mail folders, by right clicking on them in the Finder, then choose Archive/Compress.
Users/YourUserName/Library/Mail
Users/YourUserName/Library/Mail Downloads
(Could be a different folder here if you chose such in Mail Prefs)
Right click on that Mail folder, choose archive, you'll get everything in the folder, and the folder itself in a file called Mail.zip, move it to a safe place, same for the Mail Downloads folder... only the plist is separate.
/Users/YourUserName/Library/Preferences/com.apple.mail.plist -
Problem with OLAP SAPBI SHOWING Server in not responding
Hi All,
Problem with OLAP SAPBI SHOWING Server in not responding
SBO0001)",
Iam Creating a universe , When iam Retriving my olap cube query it showing the error "Server in not responding (SBO0001)",
Thanks In advance
Praveen Kumar YagnamurthyI am receiving this same error. I have these additional details:
CS: COM Provider CLSID not specified or erroneous
In my case, this is for a universe that I created in BOE XI R2 sp5.4 and migrated up to BOE XI 3.2 sp2. This connection uses OLEDB. I have the same situation with another universe that I migrated over that uses an ODBC connection and it works fine.
In my case, I am not using OLAP. -
i am having a problem with my iphone 4s. it is not displaying its volume bar in music or anywhere when not connected to earphones. kindly help me with its volume settings.
Have you tried the restart/reset/restore troubleshooting path? That would be the best initial set of steps to take, particularly in a situation like this.
-
Hi! I have a problem with the adjustment brush some are not there anymore like soften skin, how i can fix that?
Hi dear,
it's funny, real funny.
I think the programmes have diffrent sound system from the normal calls system.
All you need to do is to turn the sound up from the bottom in the phone side in the time you're making or recieving the call.
you'll hear the sound.
I hope that would help.
All the best -
I bought an iphone 5 in the United States. It has major problems with the video. In Italy not fix it. What am I to do?? back in the United States
The iPhone warranty is not international. If you bought it in the US you can only get service in the US. You will need to take it in to an Apple store in the US.
-
I have problem with my ipad3. I could not downgrade for ios 6.0.1 to 5.1.1. It was alarm code 3194. can u help me?, I have problem with my ipad3. I could not downgrade for ios 6.0.1 to 5.1.1. It was alarm code 3194. can u help me? Thanks...
Apple does not support downgrading iOS levels.
-
Please show us the video tutorial for this because i am having so much problem with my iphone5 bluetooth and can not send any file . So plz plz help me
You have to use airdrop which is on iOS 7
-
vine.co can not watch videos on other browsers do not have the problem with firefox firefox there just did not work, delete cookies, history
I think this problem may be caused by Yahoo's changes making it incompatible with the klatest version of FireFox.
This is suddenly affecting many many people who use Firefox and are members of Yahoo Groups. All these people say they themselves changed nothing and have not been locked out before when using Firefox. But suddenly, within the last week, they are.
What did Mozilla do or what did Yahoo do to cause this problem? I can say that I was not blocking cookies and after trying a number of things to fix it, I went to Yahoo's home page and navigated to my group from here.
This problem is not anything a user did. Either Firefox is at fault or Yahoo is. I want to know which company is at fault and when they are going to fix it. -
Ora-7217 sltln environ variable not set..
Here's the story..
Oracle 8.1.7 on RHat 6.2..
Installation unbelievably perfect!!!
no core dump in any programs like sqlpus, svrmgrl..but..
trying to start with svrmgrl..connect internal or thru sqlplus as sysdba
ora-7217--sltln environment var not set
keeps coming..made sure all the vars are
set in .profile..any clue what's happening?
vinny.A way to set environment variables to binaries is to specify
it on the command line. For example:
LD_LIBRARY_PATH=/usr/mylibs httpd
If you are using apache, it could be changed in the /etc/init.d/apache
script.
If you use a script to startup the server, you can use the same approach.
I am not sure about the obj.conf file.
Sun - DTS
Maybe you are looking for
-
Any way to Restore Last Manual Sort Order or Prevent from being Overwritten accidentally?
Help! I'm constantly accidentally overwriting painstakingly created manual sort ordering (sometimes hours but more often months of accumulated work) in folders with files numbering up to 1,000, when i, however breifly, switch to another sor
-
Hi All, I am trying to encode the url, pass spme parameters and decode them in another jsp. Encoding: <a href="<c:url value="abc.jsp"> <c:param name="folder" value="${sectionValue.foldername}"/> <c:param name="
-
CHILD form error FRM-30100: Block must have at least one primary key item.
Hi friends, I have increased the DML array of the child block from 1 to 10, but it throws me error: FRM-30100: Block must have at least one primary key item. Block: CEC_ADJUSTMENT_RECON Form: CEC_ADJ FRM-30085: Unable to adjust form for output. How d
-
How can I import my regular Android Browser Bookmarks to Firefox?
I want to have all of my bookmarks from my old/Google+ browser on Firefox also. Thank you. Andy Heller <sub>edit: removed your mail address from public display, since the only thing it will attract are spam bots. you will be notified per mail once so
-
Think Vantage Access Connections - problem
I have a ThinkPad X61 Tablet, which I bought in 2009 with Windows XP. Lately, i.e., last 15 days, whenever I try to use the Think Vantage Access Connections to access my wireless connections the window of the program opens up but I see only the upper