?
Solved

Calling UNIX executable file from Forms 4.5

Posted on 2001-07-12
5
Medium Priority
?
887 Views
Last Modified: 2007-11-27
Can we call UNIX executable from Forms 4.5 on WIN NT? What are the settings are required on local PC and remote UNIX machine?
0
Comment
Question by:shah_rupesh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Expert Comment

by:misho2000
ID: 6276566
You can call any executalbe only on server side via
 alias extproc in tnsnames.ora and listener.ora. I don't think that you need to setup something on local machine. The server side should be configure properly based on listener configuration.
0
 

Accepted Solution

by:
lcheecho earned 200 total points
ID: 6288890
Step 1: Create the OSUTIL package at the UNIX machine with the following: (I'm using Oracle8 as example)

set echo on
spool sysDBF_ExternalPROC.log

CREATE OR REPLACE LIBRARY libosint IS
  --  This defines the alias library which registers
  --  the external shared library within the Oracle8
  --  data dictionary.
  -- please replace this with your own $ORACLE_HOME/lib/libosint.so
  '/oracle/app/oracle/product/8.1.5/lib/libosint.so';
/

CREATE OR REPLACE PACKAGE osutil IS

  PROCEDURE RunOsCmd(cmdin IN VARCHAR2, cmdoutput OUT VARCHAR2);
  --  Purpose: External procedure to run an OS command
  --  and capture the results.
  --  Input Arguments:
  --          cmdin - the OS command to run
  --  Output Arguments:
  --          cmdoutput - output value of OS command

  PROCEDURE R_RunOsCmd(acmd IN VARCHAR2);
  --  Purpose: Wrapper used to run the external
  --  procedure, "RunOsCmd". The dbms_output package is
  --  used to print the results.
  --  Input arguments:
  --          acmd - an OS command

end osutil;
/

CREATE OR REPLACE PACKAGE BODY osutil IS
  PROCEDURE RunOsCmd(cmdin IN VARCHAR2, cmdoutput OUT VARCHAR2)
  IS EXTERNAL
    NAME "RunOsCmd"
    LIBRARY libosint
    WITH CONTEXT
    PARAMETERS (CONTEXT,
        cmdin                 STRING,
        cmdin        INDICATOR SHORT,
        cmdin             LENGTH INT,
        cmdoutput             STRING,
        cmdoutput    INDICATOR SHORT,
        cmdoutput         LENGTH INT );

  PROCEDURE R_RunOsCmd(acmd IN VARCHAR2) IS

   cmd_out   VARCHAR2(32767); -- output of OS command
   i         INTEGER;         -- counter variable
   j         INTEGER;         -- counter variable
   len       INTEGER;         -- length of command output
   cnl       CHAR(1) := chr(10); -- "newline" character

  BEGIN

   dbms_output.enable(32767);  -- enable a large output buffer
   RunOsCmd(acmd, cmd_out);    -- call the external procedure

   IF (cmd_out IS NULL) THEN
     dbms_output.put_line('ERROR, bad command or no output returned...');
   ELSE                -- output one line at a time
     len := length(cmd_out);
     i := 1;           -- start at first char
     j := instr(cmd_out,cnl,i,1); -- find first newline char
   LOOP
     dbms_output.put_line(substr(cmd_out,i,j-i)); -- print the line
     IF (j = len) THEN
        EXIT;
     END IF;
     i := j + 1;                  -- start after last newline
     j := instr(cmd_out,cnl,i,1); -- find the next newline
   END LOOP;
   END IF;

end R_RunOsCmd;

END osutil;
/

GRANT EXECUTE ON "SYS"."OSUTIL" TO "PUBLIC";

spool off

Step 2: Personally I prefer to call the UNIX exe thru Oracle Package

     lc_system_command varchar2(1000);
     lc_result varchar2(1000);

-- assign your OS command to variable
                lc_system_command := ....

-- call the system exe
                osutil.runoscmd(lc_system_command, lc_result);

Step 3: From From4.5, call the package to run the UNIX command.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7063549
Hi shah_rupesh,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. If there is no objection or further activity, I will suggest to:

    Accept lcheecho's answer.

shah_rupesh, if you think your question was not answered at all, you can post a new comment here.  Community Support moderators will followup.

Please do not accept this comment as an answer!

EXPERTS: Your input and closing recommendations are REQUESTED.
==========
shah_rupesh -- EE database cleanup volunteer
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7082996
Recommended disposition:

    Accept lcheecho's answer.

DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 7091152
Thanks for your help here, Dan.
Finalized,  item closed.
Moondancer - EE Moderator
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question