Operating System - HP-UX
1752774 Members
5056 Online
108789 Solutions
New Discussion

Re: Unable to connect to DB when run from inetd on HP-UX

 
Preet303
Occasional Contributor

Unable to connect to DB when run from inetd on HPUX

OS - HPUX11.1 and 11.31

I am running my service and it connects with the DB and it is run under inetd. The ODBC driver is loaded dynamically through dlopen. When I run from the commandline it is running properly but when run as a service the dlopen is not able to load the shared library. It fails with an error unable to open the shared library. . The same library gets loaded through dlopen without any issue if invoked on a commandline. dlopen is supposed the search the shlib_path and others but it does not seem to do when invoked from a inetd service. Is there a way I can set the environment for dlopen when invoked from a service.  Please advice

Thanks

P  

6 REPLIES 6

Re: Unable to connect to DB when run from inetd on HPUX

Any service started by inetd is going to inherit its environment (which includes the settings for SHLIB_PATH /  LD_LIBRARY_PATH) from the inetd daemons own environment. You could try setting these env variables in /sbin/init.d/inetd , but to be honest, that will mean anything started by inetd will get those settinsg too, which is not ideal and really anything started by inetd should really be able to control its own env settings via some sort of control file


I am an HPE Employee
Accept or Kudo
Dennis Handly
Acclaimed Contributor

Re: Unable to connect to DB when run from inetd on HP-UX

Can you modify the program to use putenv(3) to set your own paths?

Preet303
Occasional Contributor

Re: Unable to connect to DB when run from inetd on HPUX

Hi Duncan

 

   thanks for the response, I can across dlsetlibpath which says you can set the path dlopen can search, in the code. The man on this function seemed to be exactly what we are looking for. but when I incorporated that function, compilation went through but the link failed saying unresolved external symbol for dlsetlibpath. We tried out incorporating -ldl to the ld path but still the same problem. Does anyone know what option to specify for the link to succeed. What is the library which has this implemented. Do I need to upgrade the library.

 

thanks

P

Dennis Handly
Acclaimed Contributor

Re: Unable to connect to DB when run from inetd on HP-UX

>We tried out incorporating -ldl to the ld path but still the same problem. What is the library which has this implemented. Do I need to upgrade the library?

 

It should be there on your 11.31 system.  For 11.11, you probably need a newer linker/dld patch.

Preet303
Occasional Contributor

Re: Unable to connect to DB when run from inetd on HP-UX

Thanks, I tried out putenv and it worked. I have not tried dlsetlibpath on 11.31, but now as putenv works, we will go with that.

 

Thanks

P

Dennis Handly
Acclaimed Contributor

Re: Unable to connect to DB when run from inetd on HP-UX

>Thanks, I tried out putenv and it worked.

 

If you are happy with the answers, please click the Kudos stars.