How to execute sqlplus command in html_db

The problem for this is caused that we wanna create a Java procedure for host calls on Unix environment, it seems be working on oracle database, and right now we want to use it under html_db, but we can't find any places to be able to execute the following commands "exec rc('/bin/ps -ef');" or "exec :x:= run_cmd('/bin/ps -ef');", html_db engine always complain this is not the invalid sql command when I type it in sql workshop. How can I do it in html_db? Hope any experts help me of it. Thanks already!

thanks again Fred,
I tried using both htp.p(run_cmd('/bin/mkdir /tmp/linkin'))
I did this because if the command was executed then i should be able to see the director being created in the /tmp directory. Its still not the case. But am able to create one from sqlplus :-).
Still wondering how to solve this. If you have any suggestion of submitting a shell job from within htmldb, please let me know.
Anand

Similar Messages

  • How to execute sqlplus command in bat file ?

    Hello
    I have a simple script file that looks like this:
    "sqlplus admin/admin as sysdba
    shutdown immediate"
    But.. when i start this file.bat my system logs but do not make any script. Sqlplus just waiting for command, and when i write "exit" i logout from sqlplus, and then system execute next command, that is "shutdown immediate" but beyond sqlplus (so my base is still working). Is it at all possible to log on and execute commands from file.bat or some other way ?
    I'm using oracle 11g, windows 7x64
    Regards and thx for help
    Edited by: 879529 on 2011-11-27 04:52

    969970 wrote:
    Thank you that worked for me.But I fear you don't really understand WHY it worked, and WHY your first attempts did not work.
    So let me explain
    Given this .bat file
    sqlplus / as sysdba
    shutdown immediateWhat happens when you execute the file? The windows command processor reads the file line by line and processes the command on each line. What is the first lilne?
    sqlplus / as sysdbaSo what would you expect to happen when Windows processes that line? Remember, it's exactly as if you had entered that command yourself at the command prompt .... Answer: The OS locates an executable file named 'sqlplus', loads it into memory and passes control to it, along with a pointer to the rest of the command line ('/ as sysdba'). At that point, the executable sqlplus has control and will do whatever it wants with the command line it was passed ('/ as sysdba') and then waits for user input for more commands, including an 'exit' command. Where are those commands going to come from? They are NOT going to come from the next line in the bat file. They can't. The command processor that is running the bat file is still waiting for sqlplus to finish and return control. So you are stuck. The only way out is to break out of sqlplus with a 'ctl-break'. Once that happens, the command processor moves on to the next line in the bat file:
    shutdown immediateSo now the os tries to locate an executable file named 'shutdown' .... you probably don't have an executable by that name (let's hope not!) so you then get an error message from the OS informing you that
    'shutdown' is not recognized as an internal or external command,
    operable program or batch file.Now, if you were using a real OS, you could achieve what you wanted by using input redirection, but unfortunately, Windows just has a toy for a command processor.

  • How to execute sqlplus command like 'show parameters '  in SQL Developer?

    Hi guys,
    here's another problem i just ran into, is it possible to run sqlplus cmd like 'show parameters ' in this tool? anyone can help? thanks in advance.

    thanks.
    and i just looked into the user guide and found that several sqlplus commands were unsupported in SQL Developer, including 'show '. i don't know why but anyway i get the answer, i can go back to use sqlplus itself.

  • Execute SQLPLUS command using JDBC

    Hi,
    I was wondering if its possible to execute sqlplus command (eg set define off, change date format ..etc) using JDBC ?
    Can anyone please post me some sample codes about this ?
    Any help will be appreciated

    Hi,
    But the Runtime.exec() and the JDBC application have
    their own connection to the database, and the sqlplus
    commands that i need to run are session based (only
    valid during the connection). eg set define off
    How do I overcome this ?
    Huh?
    You put anything you want into a input file. You feed the input file to sqlplus. If there are results then you put them into an output file.
    None of that has anything to do with JDBC nor even with java. When you call Runtime.exec() you are running a completely different process. What you do with that process is up to you.

  • How to execute unix command line from cocoa?

    how to execute unix command line from cocoa?
    for example, if I want to call "ping" from cocoa, how should I do it? and how can I obtain the return value?
    thank you.
    Power G5 Quad Mac OS X (10.4.3)

    The following article may also help:
    http://cocoadevcentral.com/articles/000025.php
    Mihalis.
    Dual G5 @ 2GHz   Mac OS X (10.4.6)  

  • How to run sqlplus commands in php

    Hello,
    I want to start and stop the oracle database from php page but i get the following error:
    ORA-00900: invalid SQL statement in /var/www/shutdown.php on line 13I read somewhere that oci_execute cannot execute sqlplus commands, so my question is if you know some workaround for this issue?
    Also I want to start the database also from a php page but I get the following error:
    ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist Linux Error: 2: No such file or directory Process ID: 0 Session ID: 0 Serial number: 0 So can you help me with some hints ?
    Thank you,
    Danut
    Edited by: user9223471 on Apr 18, 2011 11:37 PM

    PHP OCI8 doesn't implement SQL*Plus client-tool commands like "SET PAGESIZE", "TTITLE" etc. Any statement you do an oci_parse() on is sent to the DB which only understands SQL & PL/SQL (ok, and XQUERY).
    PHP OCI8 can't start or stop the DB directly. It doesn't call the underlying C OCI8 OCIDBStartup() or OCIDBShutdown() functions (these functions are documented in http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10646/oci10new.htm#LNOCI096)
    You could patch PHP OCI8. Or think of an alternative business process / system architecture, such as using Enterprise Manager.

  • How to execute a Command Prompt command from J2SE code executing on Windows

    How to execute a Command Prompt command from J2SE code executing on Windows??
    Please help me

    [http://java.sun.com/docs/books/tutorial/getStarted/]
    ~

  • How to execute Linux command from Java app.

    Hi all,
    Could anyone show me how to execute Linux command from Java app. For example, I have the need to execute the "ls" command from my Java app (which is running on the Linux machine), how should I write the codes?
    Thanks a lot,

    You can use "built-in" shell commands, you just need to invoke the shell and tell it to run the command. See the -c switch in the man page for your shell. But, "ls" isn't built-in anyays.
    If you use exec, you will want to set the directory with the dir argument to exec, or add it to the command or cmdarray. See the API for the variants of java.lang.Runtime.exec(). (If you're invoking it repeatedly, you can most likely modify a cmdarray more efficiently than having exec() decompose your command).
    You will also definitely want to save the returned Process and read the output from it (possibly stderr too and get an exit status). See API for java.lang.Process. Here's an example
    java.io.BufferedReader br =
    new java.io.BufferedReader(new java.io.InputStreamReader(
    Runtime.getRuntime().exec ("/sbin/ifconfig ppp0").
    getInputStream()));
    while ((s = br.readLine()) != null) {...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to execute  make  Command?

      Run in the terminal inside the  make command,prompt:"-bash:make:command not found"  My system version is Mac OS X 10.7.3 Xcode Version is 4.3.
      How to execute  make  Command?
                                    thanks!!

    I switch to / usr / bin directory also did not find the make  only to find a makeinfo. Google to find relevant information, if installed Xcode will be able to run make, but now does not work.
    But still thank you very

  • How to execute Dos Command 'Pause' from Java ?

    How to execute Dos Command 'Pause' from Java ?
    I have read the article in javaworld for Runtime.exec() anomalies.
    Can someone please give an insight on this?

    Thanks Buddy!
    That was very useful. Even though its a simple
    solution, I never thought about that.Bullshit! Reread reply #7 of http://forum.java.sun.com/thread.jspa?threadID=780193

  • How to execute external command?

    How to execute follow command and get its ouput on linux ?
    $ grep processor /proc/cpuinfo | wc -l

    sabre150 wrote:
    nitelia wrote:
    String[] command = {"sh","-c","grep processor /proc/cpuinfo | wc -l"};
              Process pro = Runtime.getRuntime().exec(command);
              BufferedReader bf = new BufferedReader(new InputStreamReader(pro
                        .getInputStream()));
              String x = null;
              while ((x = bf.readLine()) != null) {
                   System.out.println(x);
         This should workWow! So all one has to do is to use a shell to run the command! Isn't it a pity I did not give this solution in reply #3?You old sabre rattler! ;-)

  • Executing SQLPLUS command from Stored Procedure

    Hi,
    I am trying to execute the SQLPLUS command (CONNECT) from the stored procedure.
    It is throwing below error message.
    Stored Procedure:
    SQL> select user from dual
    2 ;
    USER
    SYS
    SQL> create or replace
    2 PROCEDURE PROCEDURE1 AS
    3 BEGIN
    4 sqlplus sys/sys@D as sysdba;
    5 --execute immediate 'create user 'kkk' identified by 'kkk';
    6 END PROCEDURE1;
    7 /
    Warning: Procedure created with compilation errors.
    SQL> show err
    Errors for PROCEDURE PROCEDURE1:
    LINE/COL ERROR
    3/9 PLS-00103: Encountered the symbol "SYS" when expecting one of the
    following:
    := . ( @ % ;
    The symbol ":=" was substituted for "SYS" to continue.
    3/22 PLS-00103: Encountered the symbol "AS" when expecting one of the
    following:
    . ( * @ & = - + ; < / > at in is mod remainder not rem
    <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
    LIKE4_ LIKEC_ between || member SUBMULTISET_
    The symbol ". was inserted before "AS" to continue.
    Please let me know whether it is possible to do or not.
    If there is possiblility how can does this be done?
    Edited by: NGK246 on Aug 28, 2012 2:21 AM

    NGK246 wrote:
    Hi,
    I am trying to execute the SQLPLUS command (CONNECT) from the stored procedure.
    It is throwing below error message.
    It would not. It will always throw an error. SQLPLUS is a Utility and not a Command/Construct, that it would be available for a Stored Procedure
    >
    SQL> select user from dual
    2 ;
    USER
    SYSWhich Database are you onto? Is it DMIP?
    SQL> create or replace
    2 PROCEDURE PROCEDURE1 AS
    3 BEGIN
    4 sqlplus sys/sys@DMIP as sysdba;
    5 --execute immediate 'create user 'kkk' identified by 'kkk';
    6 END PROCEDURE1;
    7 /
    Warning: Procedure created with compilation errors.
    SQL> show err
    Errors for PROCEDURE PROCEDURE1:
    LINE/COL ERROR
    3/9 PLS-00103: Encountered the symbol "SYS" when expecting one of the
    following:
    := . ( @ % ;
    The symbol ":=" was substituted for "SYS" to continue.
    3/22 PLS-00103: Encountered the symbol "AS" when expecting one of the
    following:
    . ( * @ & = - + ; < / > at in is mod remainder not rem
    <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
    LIKE4_ LIKEC_ between || member SUBMULTISET_
    The symbol ". was inserted before "AS" to continue.
    Please let me know whether it is possible to do or not.
    If there is possiblility how can does this be done?If you are at DMIP, you need not Login again. You can Login Manually to the Database and Execute the Procedure (in which you intend to create a User 'kkk').
    However, if you are trying to Create a User in a Different Database, You will first require a DB Link to exist to connect to the Remote Database. You will also require Explicit privileges to create any user (Although I am not sure if you can create User onto a different Database.)
    I would like to ask you, why are you creating a User on a Remote database? Can you not execute the same procedure on the Remote database and create User? Also, you are using SYS login to perform the activity. Ideally it should not be allowed. You must create a user and grant DBA rights to perform such activities.

  • How to Execute shell commands in OSB

    Team,
    My Requirement:
    I have two sftp servers name ServerA and ServerB. Need to copy files from ServerA and place it on ServerB and change the file permissions to 777 after placing the files.
    The user i am connecting to ServerB has the access to override file permissions.
    Steps
    1. With help of FTP adapter in OSB I am reading files from ServerA and writing on to ServerB  -- Completed and is working.
    2. How to override file permissions after placing the file ????? -- Yet to implement.
    Please suggest me how can i accomodate 2nd step.
    Thanks,
    Suman V.

    If by "execute shell commands" you mean actually
    running a shell process (as opposed to just forking
    and executing specified programs) then I'd advise
    against it. The last thing you want is for the
    clients to be running arbitrary commands on the
    server. You don't want to make it possible for the
    client to run "rm -fr /" on your server.Right.
    I was assuming (perhaps with more optimism than is really warranted) that the OP was going to be in complete control of which commands were executed--that there'd be a small, fixed set in response to certain user actions.

  • How to execute unix command through odi and store the result in table

    I have to reconcile  if data is loaded in table from csv file or not . I have to create a oracle data integrator package/interface/procedure to execute unix command to count number of rows in the csv files and store the count result in a table then i have to query the loaded table and count number of rows there and store in the table and have to compare is counts are same or not,  Please assist me how to make package/interface/procedure to  execute unix command and store result in oracle table.
    Thanks in Advance

    Use ODI OS command tool in the ODI package.
    create an interface in ODI using LKM File to Sql and the output file generated with the csv file's row count as a source and the db table(where the count needs to be stored) as a target

  • How to execute unix command in plsql block( urgent)

    Hi All,
    i want rename the unix folder to New name on update non_employee table . So, please give me idea how to use unix command here.... Please suggest me ASAP ... Its urgent
    CREATE or REPLACE TRIGGER NON_EMPLOYEE_AftUpd_trg
    AFTER UPDATE ON NON_EMPLOYEE
    FOR EACH ROW
    BEGIN
    IF :new.DIST_LIVELINK_PATH <> :old.DIST_LIVELINK_PATH THEN
    rename unixfolder1 to :new.dist_livelink_path.
    end IF;
    END;

    The solution will depend a lot on your Oracle version, which you forgot to mention ;)
    btw shouldn't that be (in pseudocode)
    rename :old.dist_livelink_path to :new.dist_livelink_pathotherwise it will always fail after the first time?
    In Unix that would require the mv command.

Maybe you are looking for