Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: External functions and SHLIB_PATH

Re: External functions and SHLIB_PATH

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Tue, 21 Sep 1999 08:44:34 -0400
Message-ID: <Wn3nN8KxKMrB4EroRAXIRMeIr8vb@4ax.com>


A copy of this was sent to "Steve Baldwin" <steven.baldwin_at_hancorp.com.au> (if that email address didn't require changing) On Tue, 21 Sep 1999 10:45:57 +1000, you wrote:

>Hi,
>
>I have a situation where I have an external function which makes a call to
>another 'C' shared library. I'm working on HP-UX (10.20), which gives a
>link option to search an environment variable SHLIB_PATH at run time when
>loading shared libraries. The problem I have is when I build my external
>functions and then copy them to another machine with a different directory
>structure, they fail to load when I reference them from SQL.
>
>I then thought it may be because the SHLIB_PATH environment variable of the
>extproc process (ie the process that actually executes the external
>function) was not set up correctly. So, I wrote a small external function
>that dumped the Unix environment variables to a file. Sure enough, there
>was a minimal environment which didn't even contain a SHLIB_PATH environment
>variable. Since that process is started by Oracle, rather than my own Unix
>session, that was what I was expecting. My next step was to write my own
>sessions environment variables to a file, and then read that file in an
>external function, and create the environment variables (using putenv) to
>mirror my user session. I then figured any subsequent invocations of
>external functions would use the new environment. Unfortunately I figured
>wrong. The environment variables seemed to be set up fine, but it made no
>difference. The external function still wouldn't load on the other machine.
>
>Is there any way I can get my external functions to execute on the 'other'
>machine without copying object files over, and re-linking on that machine ??
>
>Your help is much appreciated.
>
>Steve Baldwin
>
>P.S.
>Please 'cc' me on steven.baldwin_at_hancorp.com.au as well as posting back to
>the group.
>

Try this:

LISTENER =
  (ADDRESS_LIST =
    (ADDRESS=(PROTOCOL=IPC)(KEY=oracle81.world))     (ADDRESS=(PROTOCOL=TCP)(Host=sheepdog)(Port=1521))   )
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =

      (GLOBAL_DBNAME=sheepdog.us.oracle.com)
      (ORACLE_HOME= /d01/home/oracle81)
      (SID_NAME = oracle81)

    )
    (SID_DESC =
      (SID_NAME = extproc)
      (ORACLE_HOME = /d01/home/oracle81)
      (PROGRAM = extproc)
      (ENVS=SHLIB_PATH=/x/y/z,DEBUG_FILE=/tmp/test/ext_proc.log)
    )
  )
STARTUP_WAIT_TIME_LISTENER = 0
CONNECT_TIMEOUT_LISTENER = 10

o (ENVS=SHLIB_PATH=/x/y/z,DEBUG_FILE=/tmp/test/ext_proc.log)

if you want a specific set of environment variables setup for your extproc routines, put them here, separated by commas. The above for example, sets up 2 environment variables for the extproc servcies, SHLIB_PATH and DEBUG_FILE. Since extprocs run detached from a console and are a little touchy to debug, having copious amounts of 'tracing' that you can enable/disable via the environment is suggested (by me)...

remember to bounce the listener after doing this change.

--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Tue Sep 21 1999 - 07:44:34 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US