Host Command Problem

hi,
I'm running on OpenVMS 7.2-1 (no unix in this shop) trying to get the HOST command to return status. In desperation I created a dummy form with 1 button that when pressed issues:
HOST('lalala');
if not form_success then
message ('bad status returned');
else message ('good status returned');
end if;
Form_Status always returns success, even for totally bogus commands (like 'lalala'). I've put the test_cmd into a varchar2 in the pl/sql, I've put it in a dummy.com file then had the host file call dummy.com... I can't get anything except a successful status to return. What's up. That's what all the ora docs say to do. Any hints?
thanks
Sandy

(2nd try. 404 on 1st reply)
I would agree that the form is behaving as though it never sees the OS error.
I tried both w/ & w/o no-screen and the results back to the form are the same (form_success = true), however w/o no-screen at least displays on the os cmd line the error.
I tried tool_env.getvar returning '$status' returns blank.
My form calls host('@dummy.com') where dummy.com does "exit $status". Show symbol $status does show an error but the form is not getting it.
sg

Similar Messages

  • Host Command Problems on 9i Unix

    I am using web froms 9i running on a Unix server with 9iasr2. I am trying to manipulate files on the server not the client. I have tried:
    host('rm -f /mypath/filename.txt')
    host('rm -f /mypath/filename.txt',NO_SCREEN)
    host('touch /mypath/filename.txt')
    host('touch /mypath/filename.txt', NO_SCREEN)
    host('mv /mypath/file1.txt /mypath/file2.txt')
    The file I am trying to delete is one that was transfered using the webutil file transfer.
    I have tried to check the status with:
    IF NOT Form_Success THEN
         Message('Error -- Message not sent.');
    ELSE
         Message('Message Sent.');
    END IF;
    I always get back 'Error...'
    The directories have permission open to everyone. Therefore I would of expected no problems with doing a touch to create a file.
    Any ideas?

    Thanks Ino. That was it, the full path for the unix command itself was missing. I knew it was something simple. =)

  • PL/SQL Procedure Calling Java Host Command Problem

    This is my first post to this forum so I hope I have chosen the correct one for my problem. I have copied a java procedure to call Unix OS commands from within a PL/SQL procedure. This java works well for some OS commands (Eg ls -la) however it fails when I call others (eg env). Can anyone please give me some help or pointers?
    The java is owned by sys and it looks like this
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "ExecCmd" AS
    //ExecCmd.java
    import java.io.*;
    import java.util.*;
    //import java.util.ArrayList;
    public class ExecCmd {
    static public String[] runCommand(String cmd)
    throws IOException {
    // set up list to capture command output lines
    ArrayList list = new ArrayList();
    // start command running
    System.out.println("OS Command is: "+cmd);
    Process proc = Runtime.getRuntime().exec(cmd);
    // get command's output stream and
    // put a buffered reader input stream on it
    InputStream istr = proc.getInputStream();
    BufferedReader br = new BufferedReader(new InputStreamReader(istr));
    // read output lines from command
    String str;
    while ((str = br.readLine()) != null)
    list.add(str);
    // wait for command to terminate
    try {
    proc.waitFor();
    catch (InterruptedException e) {
    System.err.println("process was interrupted");
    // check its exit value
    if (proc.exitValue() != 0)
    System.err.println("exit value was non-zero: "+proc.exitValue());
    // close stream
    br.close();
    // return list of strings to caller
    return (String[])list.toArray(new String[0]);
    public static void main(String args[]) throws IOException {
    try {
    // run a command
    String outlist[] = runCommand(args[0]);
    for (int i = 0; i < outlist.length; i++)
    System.out.println(outlist);
    catch (IOException e) {
    System.err.println(e);
    The PL/SQL looks like so:
    CREATE or REPLACE PROCEDURE RunExecCmd(Command IN STRING) AS
    LANGUAGE JAVA NAME 'ExecCmd.main(java.lang.String[])';
    I have granted the following permissions to a user who wishes to run the code:
    drop public synonym RunExecCmd
    create public synonym RunExecCmd for RunExecCmd
    grant execute on RunExecCmd to FRED
    grant javasyspriv to FRED;
    Execute dbms_java.grant_permission('FRED','java.io.FilePermission','/bin/env','execute');
    commit
    Execute dbms_java.grant_permission('FRED','java.io.FilePermission','/opt/oracle/live/9.0.1/dbs/*','read, write, execute');
    commit
    The following test harness has been used:
    Set Serverout On size 1000000;
    call dbms_java.set_output(1000000);
    execute RunExecCmd('/bin/ls -la');
    execute RunExecCmd('/bin/env');
    The output is as follows:
    SQL> Set Serverout On size 1000000;
    SQL> call dbms_java.set_output(1000000);
    Call completed.
    SQL> execute RunExecCmd('/bin/ls -la');
    OS Command is: /bin/ls -la
    total 16522
    drwxrwxr-x 2 ora9sys dba 1024 Oct 18 09:46 .
    drwxrwxr-x 53 ora9sys dba 1024 Aug 13 09:09 ..
    -rw-r--r-- 1 ora9sys dba 40 Sep 3 11:35 afiedt.buf
    -rw-r--r-- 1 ora9sys dba 51 Sep 3 09:52 bern1.sql
    PL/SQL procedure successfully completed.
    SQL> execute RunExecCmd('/bin/env');
    OS Command is: /bin/env
    exit value was non-zero: 127
    PL/SQL procedure successfully completed.
    Both commands do work when called from the OS command line.
    Any help or assistance would be really appreciated.
    Regards,
    Bernard.

    Kamal,
    Thanks for that. I have tried to use getErrorStream and it does give me more info. It appears that some of the commands cannot be found. I suspected that this was the case but I am not sure about how this can be as they all appear to reside in the same directory with the same permissions.
    What is more confusing is output like so:
    SQL> Set Serverout On size 1000000;
    SQL> call dbms_java.set_output(1000000);
    Call completed.
    SQL> execute RunExecCmd('/usr/bin/id');
    OS Command is: /usr/bin/id
    exit value was non-zero: 1
    id: invalid user name: ""
    PL/SQL procedure successfully completed.
    SQL> execute RunExecCmd('/usr/bin/which id');
    OS Command is: /usr/bin/which id
    /usr/bin/id
    PL/SQL procedure successfully completed.
    Regards,
    Bernard

  • WEBUTIL problems importing a file with the HOST command.

    We are investigating a problem where the users are trying to import a file in from the webserver to be used by the application. The users have successfully moved the file from their local PC to the application server. But, when we perform a HOST command to have the form moved to the UNIX directory, the form hangs. The very last statement of the .BAT file used in the HOST command does the move of the file. And, we can see the entire file in the UNIX directory, we just don't get return back to the form.
    I added displays before and after the HOST command in the form. I see the display before the command but don't receive anything after. The weird thing is this is only happening in our development server. The same issue is not happening in production. Also, if I run the form in client server mode, it works fine also. So, it has to be something on the development application server.
    If anyone has any advice, I would appreciate their help.
    Thanks.

    On the server (assuming Windows since you mention a batch file), locate the Oracle Process Manager Service (for mid tier) on the MS Services Console. Open the properties for this service and click on the "Log on" tab. Check the box labeled "Allow service to interact with desktop".
    That said, if you are executing a batch file on the Windows server to transfer another file to a Unix machine, the above likely won't work either. This is because Windows will not allow a service permission to access network resources (for security purposes). In this case, rather than the above, you will need to change the same setting so a real domain user and not the "Local System" account.

  • Problem using Host command to call a batch file

    Hi all,
    I am trying to call a batch file with the Host command:
    host c:\test\u.bat
    where u.bat calls unix2dos.exe with a parameter of d_unix.txt.
    Bat file looks like this:
    C:\test\unix2dos.exe d_unix.txt
    PAUSE
    The bat file gets called fine, but the following error occurs (in the cmd prompt):
    T:\globals\ORACLE8\bin>C:\test\unix2dos.exe d_unix.txt
    d_unix.txt:
    Can't open file
    T:\globals\ORACLE8\bin>PAUSE
    Press any key to continue . . .
    Running the batch file directly in windows works fine. The batch file also runs fine from the Host command if I remove the d_unix.txt parameter.
    The file d_unix.txt file is in the same directory as the batch file and as unix2dos.exe.
    Running from Sql Plus in a windows environment.
    Any thoughts?
    Edited by: dgouin on Aug 19, 2009 11:41 AM
    Edited by: dgouin on Aug 19, 2009 11:42 AM
    Edited by: dgouin on Aug 19, 2009 11:42 AM

    I always understood that it worked with whatever directory you were in when you launched the SQL*Plus binary:
    D:\>SQLPLUS dbuser@testdb
    SQL*Plus: Release 10.2.0.4.0 - Production on Wed Aug 19 15:26:35 2009
    Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
    Enter password:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    dbuser@testdb > HOST ECHO %CD%
    D:\
    dbuser@testdb > exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    D:\>H:
    H:\>SQLPLUS dbuser@testdb
    SQL*Plus: Release 10.2.0.4.0 - Production on Wed Aug 19 15:27:03 2009
    Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
    Enter password:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    dbuser@testdb > HOST ECHO %CD%
    H:\
    dbuser@testdb > exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options

  • HOST command not working in forms 10g

    Hi,
    I have migrated forms 6i to forms 10g, and having a requirement to open sqlplus prompt using a form menu. I have used the below command: -
    "host('sqlplus '||user_name||'/'||pass||'@'||sid, no_screen);"
    But I am not able to get the sqlplus window, and the main form is still in process for long time, till i bounce the server.
    The forms are deployed on Oracle Applications Server 10g and i want to run it on server side.
    Please help me with the problem.
    Thanks,
    Ankit

    The deployment architecture is different between forms 10g and forms 6i.
    In Forms 6i HOST built-in command will run on the client machine since you are running as client/server, but in WebForms (Forms10g) the HOST built-in command will run on the middle tier which is your application server machine.
    In order to run hosts commands in WebForms you need to use webutil and use CLIENT_HOST in the webutil.
    check the [Forms 10g R2 Demo|http://download.oracle.com/otndocs/demos/Forms_Demos_10gr2.zip] for sample codes of webutil.
    You are using NO_SCREEN in your example, this will hide the window.
    Tony
    Edited by: Tony Garabedian on Nov 26, 2009 2:43 PM

  • How to execute host command in trigger

    dear professional:
    i'm trying to create a trigger that when a certain value inserts into a table , it fires some UNIX command to do the job following
    here is what i tried ,create a trigger that gives host command , but when i tried insert , it fails to work
    i also tried dbms_pipe ,but seems same when using dynamic sql to do the job
    any idea of how to accomplish this task ?
    many thanks ~
    br/ricky
    SQL> CREATE OR REPLACE TRIGGER price_exec
    2 BEFORE INSERT ON omc.price_test
    FOR EACH ROW
    BEGIN
    IF :NEW.price = 4 THEN
    execute immediate 'host ll';
    END IF;
    END price_exec;
    / 3 4 5 6 7 8 9
    Trigger created.
    SQL> insert into price values ('test',4);
    insert into price values ('test',4)
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> insert into price_test values ('test',4);
    insert into price_test values ('test',4)
    ERROR at line 1:
    ORA-00900: invalid SQL statement
    ORA-06512: at "OMC.PRICE_EXEC", line 3
    ORA-04088: error during execution of trigger 'OMC.PRICE_EXEC'

    hi,
    my db is 9.2
    i'm aware of schedule you mentioned , but if it's up to the task , you don't know when a row with certain value is inserted
    simple way :
    when a row inserted into a table with value "catch me" you want to know who inserted this test value
    so you tried to create a trigger to catch program, machine, module ,and terminal info from v$session
    so you can figure out where it is coming from
    and i want to go a step further , by executing some os command to digging out more
    and i come up with this , when value 4 is inserted i exec a procedure host to execute command,
    the problem is it's not working as i exepcted , so spare me the lecture of reading docs and just tell me what to do
    i'd really appreciate it , thanks
    CREATE OR REPLACE TRIGGER price_exec
    BEFORE INSERT ON omc.price_test
    FOR EACH ROW
    BEGIN
    IF :NEW.price = 4 THEN
    execute immediate 'host('echo')';
    END IF;
    END;
    Warning: Trigger created with compilation errors.
    SQL> show errors
    Errors for TRIGGER PRICE_EXEC:
    LINE/COL ERROR
    3/30 PLS-00103: Encountered the symbol "ECHO" when expecting one of
    the following:
    . ( * @ % & = - + ; < / > at in is mod not rem return
    returning <an exponent (**)> <> or != or ~= >= <= <> and or
    like between into using || bulk
    The symbol ". was inserted before "ECHO" to continue.

  • HOST command does not seem to work in deployment system

    I am developing forms software for a SUSE Linux system, but the HOST command does not seem to operate correctly when used in conjunction with Application Server.
    All I am trying to do is launch Adobe Acrobat reader as a background job using the command :-
    HOST('/opt/Adobe/Reader8/bin/acroread &');
    but nothing seems to happen.
    If I enter the command :-
    */opt/Adobe/Reader8/bin/acroread &*
    directly from a shell window (using the same login account) the command works correctly.
    I have tried other commands e.g. directory listings etc and all seem to have the same problem.
    Furthermore when the same form is run from the development environment using "Internet Developer Suite" it operates correctly with no problems.
    I am running on a deployment system where all three tiers of oracle are on the same machine (i.e. Database, AS and web front end).
    Can anybody suggest any possible causes or anything I can try to help resolve this problem ?

    brian_a_j wrote:
    Although I still dont understand why HOST would not work given my configuration (the Application Server and Web Browser operate on the same machine).One little test, put the execution command in a shell script and try to execute the script with the HOST command instead of the command itself.
    Using HOST the script will be executed on the AS machine no matter from where it is executed.
    Tony

  • Webutil_file_transfer and host command doesn't work

    I use a host command in forms to execute a sql-script, which creates a file on AS. After the host command I use webutil_file_transfer to ftp the created file to the client. If I try to do this again in the same session, the host command fails. I have to restart the application to get it working again. If I leave out the webutil_file_transfer I have no problems whatsoever. It looks like webutil is changing something perhaps in the environment. Anyone has the same problem (and a suitable solution)?

    I can remove the files on AS (so there seems to be no lock). After removal of the files, no new files wil be created, even if I change the name of the file that needs to be created. Only restarting the application helps.
    Raoul

  • HOST command and Forms 4.5

    We were using HOST command(to start SQL Plus) in one of the form of our application (forms version 4.5) and this application was running fine on Win NT. Now this application is moved onto Windows 2000. Now we noticed that once the HOST command statement is executed, the application goes into hang and has to terminated. We fixed this problem temporarily by putting a message() and pause statement before and after HOST command statement and the application is running fine. I would like a better solution to this problem. If anyone has encountered this kind of problem or any idea, please reply.

    Hi, there,
    I have the same problem with my program. Have you figured it out the solution? and if not, could you show me the code of your temporary fix? my email is: [email protected]
    Thanks
    We were using HOST command(to start SQL Plus) in one of the form of our application (forms version 4.5) and this application was running fine on Win NT. Now this application is moved onto Windows 2000. Now we noticed that once the HOST command statement is executed, the application goes into hang and has to terminated. We fixed this problem temporarily by putting a message() and pause statement before and after HOST command statement and the application is running fine. I would like a better solution to this problem. If anyone has encountered this kind of problem or any idea, please reply.

  • Host command in PL/SQL Package

    Hi,
    How is it possible to launch a host command from a PL/SQL package without Pro*C nor Java ?
    Hope it's possible, 'cos Java is not available here and Pro*C has some^problems that the DBA cqn't solve...
    Could you please answer at [email protected]
    Thanks in advance !

    Hi Thomas,
    You can call external progs within PlSql.
    You have to
    - Configure Tnsnames.ora aned listener.ora on the server
    with the 'extproc' entry
    - Have an external proc in a DDL on NT (or .so on unix)
    - Create a libray pointing on this .so file with 'Create library'
    - Declare a PlSql proc calling your external proc in the library
    And then you will use your PlSql proc within your package.
    It's fastidious but it works.
    Mbo

  • Printing with host command

    Let me explain my situation.
    I have a txt file which I want to print out. I usually do this with host command which looks something like this:
    command:='print /D:\\print_server\printer file.txt';
    The problem is how to print this file in landscape.
    If this iAS would be installed on Unix platform I guess my host command would look something like this:
    command:='lp -d printer -olandscape file.txt';
    the problem is, my iAS is installed on WIN2000 server.
    any ideas........

    OK I managed to solve this problem with some dosprint.exe program (40$) which can accept various other parameters as well and one of them is also landscape.
    oh, that windows again .....

  • Host command privileges

    Hello,
    If my form does a host('cmd /c dir > d:\output.txt') I get the resulting listing on my application server but if I do a host('cmd /c net send myhost ping > d:\ouput.txt) I get an output.txt of size 0 and no message is sent. I have tried sending the message manually from the appserver and it works fine.
    Are there some restrictions on executing commands through the host command (the appserver processes run with administrator privileges so that shouldn't be a problem)? If there are restrictions, what would be the best way to get around them (wrappers etc)?
    Thanks in advance,
    Nik

    If it is a problem with privileges, you can try to use CPAU program (http://www.joeware.net/win32/) to run a command with privileges of a specified user.

  • HOST command in SQLPlus

    Hi everybody
    I have a script with two HOST commands inside one script. The problem is that the second host command is executed just before the first host command terminates. Is there a way to make the second waits till the first ends ?
    Thanks to all

    hi.
    I schedules my exports through crontab..
    I create a script for each schema export job and submit them to cron and it automatically runs the export as I scheduled them.

  • Using unix host command within plsql on aix

    On an aix platform Im trying to host out of a plsql procedure to
    use mail. I can only get the host command to work inside a blank
    .sql file. ie. first line must have the host command on it. If
    you try to imbed the host command within a procedure, the file
    will just sit there and nothing happens.
    null

    Jay,
    This forum is for Headstart related questions and experiences
    only. Please go to metalink.oracle.com to get more information on
    your problem.
    Regards,
    Lauri
    Jay Levasseur (guest) wrote:
    : On an aix platform Im trying to host out of a plsql procedure
    to
    : use mail. I can only get the host command to work inside a
    blank
    : .sql file. ie. first line must have the host command on it. If
    : you try to imbed the host command within a procedure, the file
    : will just sit there and nothing happens.
    null

Maybe you are looking for

  • Blue screen after shut down, service station won't work on reboot

    A blue screen suddenly appeared on shut down yesterday, and my laptop immediately restarted after. On restart, a message popped up saying that Toshiba Service Station stopped working. Last time I shut down my laptop the blue screen doesn't appear any

  • ISA User Admin - Mass User Create

    Hi, We are implementing B2B E-Commerce solution, with ISA User Admin as the User Creation mechanism.  For roll out we need to create in excess of 2000 users. Has anyone had any experience of a tool that could automate this process? Many thanks, Jon

  • Graph canvas size problem - missing rows

    Hi all, we have a simple horizontal bar graph based on a view, with just one total value pr. company showing. Problem is, if we set the canvas size too a small value, e.g. 400x400, then instead of resizing bars down so that all rows are shown, the gr

  • Plan Version

    Hi All, Can you please explain the concept and use of Plan Version. Regards, Chinmay

  • Automatic determination of condition group

    Hi My client has the following requirement: - For 3rd party items, in few situations we might have to supply the items immediately. - In such situations we request our supplier to supply the item directly to the customer (instead of bringing the item