Run a Shell Script via Reports

Dicas e truques sobre Oracle Reports Builder - modo gráfico ou modo caractere, ascii, arquivo .PRT, etc
  

Poston Tue, 09 Aug 2005 6:26 pm

Guys, I need to execute a shell script via Reports. I wonder if someone could help me?!

How do I make this call by the Shell reports?!
LC_JK
Location: São Paulo

Poston Wed, 10 Aug 2005 9:05 am

Hey LC_JK dude, I don't know any way to run a script location on reports. You cannot run this schell script before calling the report?
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered

Poston Wed, 10 Aug 2005 10:21 am

Actually this reports is on the Unix server (since it is a reports to the Oracle Applications), so it generates a text file in Unix tbém. I was thinking of calling this shell on the trigger After Report ... .. .and this tbém shell will be in the Unix .... ...

You have no idea how to do that?!
LC_JK
Location: São Paulo

Poston Wed, 10 Aug 2005 10:32 am

You can create a Java Stored Procedure that executes commands in the O.r. viewtopic.php?t=377 here's an example, called \"RunCommand\" viewtopic.php?t=257 that is, you create a procedure that executes commands on the server and call it wherever you want in your Reports.

Here's another example:
Code: Select all
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "HOST" AS
import java.lang.*;
import java.io.*;

public class Host
{
public static void executeCommand (String command, String etype) throws IOException
{
   String[] wFullCommand = {"C:\winnt\system32\cmd.exe", "/y", "/c", command};
   String[] uFullCommand = {"/bin/sh", "-c", command};
   if (etype.toUpperCase().equals("W"))
     Runtime.getRuntime().exec(wFullCommand);
   else if(etype.toUpperCase().equals("U+"))
     Runtime.getRuntime().exec(uFullCommand);
   else if(etype.toUpperCase().equals("U"))
     Runtime.getRuntime().exec(command);
}
};
/
Code: Select all
CREATE OR REPLACE PROCEDURE Host_Command_Proc (p_command  IN  VARCHAR2, p_etype  IN  VARCHAR2)
AS LANGUAGE JAVA
NAME 'Host.executeCommand (java.lang.String, java.lang.String)';
/
Examples
Code: Select all
host_command_proc ('cd home/yourdir/another_dir', 'U+');
host_command_proc ('rm -f *', 'U+');
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered

Poston Wed, 10 Aug 2005 8:07 pm

Dude ... This gives an error: \"ORA-29532: Java call terminated by non-Java exception detected:\".

You know what could be happening?!

ah.. and I have another doubt: the shell that will be executed has to be in the same room as this my reports?
LC_JK
Location: São Paulo

Poston Thu, 11 Aug 2005 4:21 pm

Given the necessary permissions?

viewtopic.php?t=257 (at the end of the topic has a text called \"Important\", explaining about the grants)
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered


  • See also
    Replies
    Views
    Last Post