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

Home -> Community -> Usenet -> c.d.o.server -> Re: calling 'C' external procedures from Oracle from HPUX

Re: calling 'C' external procedures from Oracle from HPUX

From: Thomas Kyte <tkyte_at_oracle.com>
Date: 18 Feb 2005 09:56:54 -0800
Message-ID: <118749414.000090f4.092@drn.newsguy.com>


In article <1108742774.933658.275230_at_l41g2000cwc.googlegroups.com>, Rauf Sarwar says...
>
>
>Thomas Kyte wrote:
><snip>
>> You do realize the plsql environment will be the SERVERS environment
>-- not the
>> clients in general. So, the environment variables you are accessing
>would
>> really be "constants", inherited from the listener (if you use
>dedicated server
>> over the network), inherited from the user that started the database
>(if you use
>> shared servers), inherited from your client application only when you
>use
>> dedicated server and a fork/exec (bequeath/local) connection -- no
>net.
>>
>>
>> And not only that, but the external procedures environment will
>always be
>> inherited from the listener since the listener forks off the extproc
>process.
>>
>> So, the environment would be the constant environment of the listner
>process if
>> you used an external procedure.
>>
>> It would be "sketchy" as to whose environment it would be using a
>java stored
>> procedure.
>
>On Windows, it uses server's SYSTEM environment via Java's Runtime
>class. i.e. Path did not include the USER's path settings... which are
>appended at the end of the system path if you type path from cmd.exe.
>Don't know if this is standard. I used this Java stored procedure,
>
>public class RuntimeTest {
>
> public static void Test ( )
> throws Exception {
>
> Runtime r = Runtime.getRuntime();
> Process p = r.exec("cmd /c echo %path%>C:\\temp\\path.txt",
>null);
> p.waitFor();
> }
>}
>Didn't have JServer installed on AIX database so cannot test the Unix
>behavior.

that makes sense since on windows, you don't "fork/exec", it creates a new thread in a process running as a service which gets its environment from there.

(bottom line effect is the same -- the client should pass into the database what it needs to pass in, using the environment is going to be "unpredicable" and won't be the clients environment)

>
>>
>> The only safe thing I think you should do is have the shell script
>pass the
>> values into the database itself. Formal parameters to your sqlplus
>script if
>> that is what you are using.
>
>Regards
>/Rauf
>

-- 
Thomas Kyte
Oracle Public Sector
http://asktom.oracle.com/
opinions are my own and may not reflect those of Oracle Corporation
Received on Fri Feb 18 2005 - 11:56:54 CST

Original text of this message

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