Java Script in a Stored Procedure

I have a stored procedure. I use HTP Pacakge to generate the Page with HTML tags.
I need to include a Javascript file in the stored procedure . I donno the path where the JS file resides in the Appserver meaning the context root.
Any help in educating me the location where JS ,CSS,IMAGE files are placed
in the appserver is most welcome.
I am using Oracle 10g DB and Oracle 10g App server.

The App Server has an Apache-based HTTP server. It uses the standard Apache config files - you can probably look at the $ORACLE_HOME/Apache/Apache/config/httpd.conf to find the document root.
The $ORACLE_HOME is the App Server's Home, not the database's Home

Similar Messages

  • Using SQL Loader script in a Stored Procedure

    Can I use SQL Loader script in a stored procedure and then execute it from a front-end appl.? The reason for this seemingly convoluted solution is that the users don't want a batch load though the records volume is quite high (around 1 mil). Other loads using ODBC connection or OLE DB seem to be inferior to SQL Loader.

    I would suggest a couple of solutions:
    1. Have a cgi script that can upload the file to the server from a web ui, then have the cgi script call the sql*loader file, and it will insert into the database.
    2. You can try to use External tables. This is avaliable in 9i and onwards. You will be able to make any sql DML on the external table.
    I would normally use sql*loader, move the data to a staging table with nologging, and paralle loading. After it has been loaded into the staging table I would process it into my main tables. Have used this approach with up to 60 million records in one load.
    You can do calls to C procedures, Pro*C procedures through PLSQL, as well as java calls, or use Java stored procedures.
    My experience is that SQL*Loader is the fastest way to load data into the database.

  • Executing Unix scripts from a stored procedure

    From the sql*plus windows, I am able to execute the host command and '!sh' commands; but I need to ececute Unix scripts from a stored procedure. Hoe can I do this? Where can I get good documentation on this? Any help would be greatly appreciated!
    Thanks..

    Hi,
    U can use external procedure ( newly added feature in 8.0.3 onwards) and call any shared library. From shared library u can execute it.
    One sql command is there HOST(' '). U can run a OS command. But u can not use it in PL/SQL.
    U can call pls sql from shell !!!!!..
    Thanks...
    Boby Jose

  • Calling unix shell script from oracle stored procedure.. urgent!!!!!!!!!!!!

    Hi,
    i havea requirement where in i should be able to call my shell script through oracle stored procedure.i tried the following way..but iam unable to get the result.please find the details below.
    new.sh - my shell script - lctfile (LCTFILE) is the input pa
    v_config_file=`find $FND_TOP -name LCTFILE
    FNDLOAD apps/s0ccer@$dxbs1 0 Y DOWNLOAD $v_config_file /home/bir4163/RPT33/bin/menu.ldt MENU MENU_NAME='AR_NAVIGATE_GUI'
    if [ $? != 0 ];then
    echo "$DATE $0 FNDLOAD DOWNLOAD Failed!" | tee -a $LOG_FILE
    else
    echo "SUCCESS" | tee -a $LOG_FILE
    fi
    CREATE OR REPLACE PROCEDURE test_dbms_scheduler
    AS
    v_text VARCHAR2 (255) := 'AR_NAVIGATE_GUI';
    BEGIN
    DBMS_OUTPUT.put_line ('I am in Procedure');
    DBMS_SCHEDULER.create_job (
    job_name => 'test_dbms_scheduler',
    job_action => '/home/bir4163/RPT33/bin/new.sh',
    number_of_arguments => 1,
    job_type => 'executable',
    start_date => SYSDATE,
    repeat_interval => 'FREQ=SECONDLY; INTERVAL=1',
    enabled => FALSE,
    auto_drop => FALSE,
    comments => 'run shell script'
    DBMS_SCHEDULER.set_job_argument_value (job_name => 'test_dbms_scheduler',
    argument_position => 1,
    argument_value => v_text);
    DBMS_SCHEDULER.enable ('test_dbms_scheduler');
    DBMS_OUTPUT.put_line ('I am back in Procedure');
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line (SQLCODE || SQLERRM);
    END;
    But iam unable to test it as i do not have permissions to access dbms_scheduler.can anybody tell me how to solve this using DBMS_PIPE with a sample code.
    please do help its very urgent
    thanks
    ramya

    Hi,
    Register your Shell Script as a concurrent program, Executable execution method "Host", then use fnd_request.submit_request to submit the program.
    Regards,
    Andries

  • Shell script invoke from stored procedure

    Hi All,
    Can anyone tell me how to call UNIX SHELL SCRIPT from oracle stored procedure PL/SQL. Example with detailed explanation.
    Please Share the needful.
    Thanks in Advance
    Pricks

    Here, The example is given below, I want to invoke the Script which i mentioned like HERE INVOKE THE ABOVE SHELL SCRIPT in that place.
    CREATE OR REPLACE PROCEDURE spwritelog
         inFileName               VARCHAR2,
         inLogMsg               VARCHAR2,
         inLogLevel               CHAR(1),
         outRc OUT NUMBER
    AS
    tmpMsg                VARCHAR2(255);
    BEGIN
    outRc := 0;
         IF inLogLevel = 'X' THEN
              tmpMsg := "echo `date +'%Y-%m-%d %H:%M:%S'` ' " || inLogMsg || "' >> " || inFileName;
         HERE INVOKE THE ABOVE SHELL SCRIPT
         ELSIF inLogLevel = "9" THEN
              tmpMsg := "echo `date +'%Y-%m-%d %H:%M:%S'` ' " || inLogMsg || "' >> /tmp/spAllLog.err";
              HERE INVOKE THE ABOVE SHELL SCRIPT
         END IF;
    EXCEPTION
    WHEN OTHERS THEN
    outRc:=SQLCODE;
    END spwritelog;
    Please correct the code and tell.......
    please share the needful
    Edited by: 866916 on Aug 19, 2011 5:38 PM

  • Shell script execution from stored procedure

    I am working on a project thallt requires a shell script be executed upon the execution of a stored procedure with Oracle 10g. I have researched the matter, but there does not seem to be much out there on how to execute lines of UNIX commands by use of a stored procedure. If anybody has ever gotten this to work, any information would be appreciated. If the task is impossible, let me know, I just could not confirm that it was not something that could be done.

    A combination of things can help you out here - none of which are easy or particularily secure.
    1) From plain PL/SQL, you can call 'external procedures'. That is basically a DLL or .so that the listener can load on demand, and that external procedure (EXTPROC) can run whatever you need from the C program. C can, in turn, call a shell.
    This is fairly well documented, but be aware that 1/2 of the info is in the PL/SQL docco and the other half in the Networking docco.
    A fair bit of info is available in metalink as well - if you have access, simply search on extproc.
    2) You can call a Java stored procedure which in turn has hooks to the outside world. That will probably require a PL/SQL to Java wrapper to make it available in your environment. Oracle has been using this one successfully for a while.
    3) Write the script using UTL_FILE and have a daemon look for, and execute, the script.
    4) Since you are using 10g, use the new job scheduler. It has excellent capability to interact with the OS, and it is available as a PL/SQL package (DBMS_SCHEDULER). I find the interface a bit heavy, but that could be wrapped by a library tailored to your specific needs.
    Let us know what you decide to do in the end (and why) - it is an interesting topic.

  • Empty strings when passing a Java object to a Stored Procedure

    Hi,
    I'm using the interface SQLData to pass Java objects to StoredProcedures. All the object's attributes 'arrive' to the Stored Procedure ok, except the strings, which are empty.
    Here is my Oracle object:
    TYPE OBJ_ASJFF_OBJ1 IS OBJECT (
    ARG1 CHAR(3),
    ARG2 NUMBER(4),
    ARG3 CHAR(4),
    ARG4 NUMBER(7),
    ARG5 NUMBER(13,2),
    ARG6 CHAR(1));
    The nested table of that object:
    TYPE TAB_ASJFF_OBJ1 AS TABLE OF OBJ_ASJFF_OBJ1;
    The procedure declaration:
    PROCEDURE Pup_Instaura_Processo (                              x_crCert IN TAB_ASJFF_OBJ1,
    x_cResult OUT CHAR(4)
    My SQLData implementation:
    public void writeSQL(SQLOutput stream) throws SQLException {
                   stream.writeString(getArg1());     
                   stream.writeInt(getArg2().intValue());
                   stream.writeString(getArg3());          
                   stream.writeLong(getArg4().longValue());     
                   stream.writeBigDecimal(getArg5());
                   stream.writeString(getArg6());
    Can anybody help me?
    Thanks in advance
    Rui Gonçalves

    not exactly what you wanted but ingredients can be found at
    - JPublisher's docuemntation (especially "Type Mapping Support Through PL/SQL Conversion Functions")
    - http://otn.oracle.com/sample_code/tech/java/jsp/Oracle9iJSPSamples.html (Best Hotels PL/SQL Sample )
    - http://otn.oracle.com/tech/xml/xdk_sample/xdksample_093001i.html
    hope this helps
    Kuassi
    I have a Java Stored procedure which takes an instance of a different java object as its parameter.
    I need to do this from a pl/sql package - can anyone point me to a sample etc (looked on the website but don't see one) ?
    Andrew

  • How to call a java method in a Stored procedure

    Hi.,
    I was trying to call a method in a stored procedure
    This was my procedure
    CREATE OR REPLACE PROCEDURE proc_copy_file(sr_file VARCHAR2,dt_file VARCHAR2)
    AS LANGUAGE JAVA
    NAME 'FileCopy.copyfile(String,String)'; // calling a java method
    /   this was my java method
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "FileCopy" as
    import java.io.File;
      import java.io.IOException;
      import java.io.FileReader;
      import java.io.FileWriter;
      import javax.imageio.stream.FileImageInputStream;
      import javax.imageio.stream.FileImageOutputStream;
      import java.security.AccessControlException;
      public class FileCopy {
          // Define variable(s).
              private static int c;
              private static File file1,file2;
              private static FileReader inTextFile;
              private static FileWriter outTextFile;
              private static FileImageInputStream inImageFile;
              private static FileImageOutputStream outImageFile;
              // Define copyText() method.
              public static void copyfile(String fromFile,String toFile) throws AccessControlException
                // Create files from canonical file names.
                file1 = new File(fromFile);
                file2 = new File(toFile);
                // Copy file(s).
                try
                  // Define and initialize FileReader(s).
                  inTextFile  = new FileReader(file1);
                  outTextFile = new FileWriter(file2);
                  // Read character-by-character.
                  while ((c = inTextFile.read()) != -1) {
                    outTextFile.write(c); }
                  // Close Stream(s).
                  inTextFile.close();
                  outTextFile.close(); }
                catch (IOException e) {
                  System.out.println ("-------"); }
             // return 1;
          public static void main(String[] args){
                          switch(args.length){
                                  case 0: System.out.println("File has not mentioned.");
                                                  System.exit(0);
                                  case 1: System.out.println("Destination file has not mentioned.");
                                                  System.exit(0);
                                  case 2: copyfile(args[0],args[1]);
                                                  System.exit(0);
                                  default : System.out.println("Multiple files are not allow.");
                                                    System.exit(0);
    };while i am executing this method i m getting error as
    ORA-29531: NO METHOD COPYFILE IN CLASS FILECOPY
    ORA-06512: AT "RMVER721.PROC_COPY_FILE", LINE 1could anyone help me

    Looks like it is a matter of not quite the same namespace for String object.
    I can get it to work by the java source containing:
              public static void copyfile(java.lang.String fromFile,java.lang.String toFile) throws AccessControlExceptionAnd the PL/SQL source:
    NAME 'FileCopy.copyfile(java.lang.String,java.lang.String)'; // calling a java methodSeems like when you just use "String", then the namespace resolving in the java source is not the same as the namespace resolving in the PL/SQL?
    Addendum:
    You do not need to put java.lang.String in the java source, String will do (java.lang is by default "imported"?)
    But in the PL/SQL source java.lang namespace prefix is needed - java.lang is not "imported" here.
    Edited by: Kim Berg Hansen on Nov 23, 2011 1:07 PM

  • Calling script in a Stored Procedure

    I have this script and want to use it in a stored procedure but while creating it, it showed me an error:
    Error: Query : CREATE PROCEDURE test.loadXMLData() BEGIN LOAD XML LOCAL INFILE
    UserApplication.xml' INTO TABLE userapplicatio... Error Code : 1314 LOAD XML is not allowed in stored procedures
    Query:
    LOAD XML LOCAL INFILE 'UserApplication.xml'
    INTO TABLE userapplication
    ROWS IDENTIFIED BY '<Group>';
    please Help me Out for finding where i m exactly making a mistake....

    Hello,
    For me it looks like a MySQL statement, right?
    This is a Forum for Microsoft SQL Server; you better should post your question to a more related forum. =>
    http://forums.mysql.com/
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Script out many stored procedures at once?

    I found lots of methods for individually scripting out stored procedures, but I'd like to know if there's a way to do many (like 100 or so) at once.
    Ideally, I'd like to execute something that would save all the procedures that start with 'dev_' to the file system somewhere, then delete the dev_ SP's from the database and leave the other SPs that actually get used.
    Is that possible in one step?  Does any one have a link or an idea?
    Thanks in advance!!

    Actually, I did slight modifications after that - here is a version that really scripts them:
    set nocount on
    DECLARE @Test TABLE (Id INT IDENTITY(1,1), Code varchar(max))
    INSERT INTO @Test (Code)
    SELECT 'IF object_ID(N''[' + schema_name(schema_id) + '].[' + Name + ']'') IS NOT NULL
    DROP PROCEDURE ['+ schema_name(schema_id) +' ].[' + Name + ']' + char(13) + char(10) + 'GO' +
    OBJECT_DEFINITION(OBJECT_ID) + char(13) +char(10) + 'GO' + char(13) + char(10)
    from sys.procedures
    where is_ms_shipped = 0
    DECLARE @lnCurrent int, @lnMax int
    DECLARE @LongName varchar(max)
    SELECT @lnMax = MAX(Id) FROM @Test
    SET @lnCurrent = 1
    WHILE @lnCurrent <= @lnMax
    BEGIN
    SELECT @LongName = Code FROM @Test WHERE Id = @lnCurrent
    WHILE @LongName <> ''
    BEGIN
    print LEFT(@LongName,8000)
    SET @LongName = SUBSTRING(@LongName, 8001, LEN(@LongName))
    END
    SET @lnCurrent = @lnCurrent + 1
    END
    Premature optimization is the root of all evil in programming. (c) by Donald Knuth
    Naomi Nosonovsky, Sr. Programmer-Analyst
    My blog

  • Java and Sybase nested stored procedures.

    Hi!
    I have nested Sybase stored procedures, the main procedure calls a helper stored proc.
    The main procedure returns 2 result sets before calling the helper store proc and helper store proc returns 1 resultset. After the helper store proc is called, the main store proc returns 2 more resultset. When I run it using SQL client tool the main procedure(and it's helper) execute well and returns rows.
    I need to call this store proc in a java code and display all the resultset in screen. I am using Statement:execute(<exec sp>) to execute the store proc and then statement.getResultSet() to get each resultset. The loop is controlled by statement.getMoreResults() .
    It displays the first 2 resultsets from main Store Proc. Then the control goes to helper store proc. It executes the helper store proc and displays the resultset from helper. But then it stops there and doesnot
    come back to main store proc to execute the remaining resultset.
    What I suspect is that, the statement object is getting overlaid when the call goes to helper proc.
    Any idea as to how to code to handle multiple nested resultset ?
    ~ RNS.
    My Sybase stored procedure code looks like -
    =======================================================================
    create procedure main_proc
    @param1 int
    as
    select getdate()
    select @@servername
    declare @return_val int
    exec proc2 @param1, @return_val out
    select myCol1,
    myCol2,
    myCol3=@return_val
    from mytable
    select db_name()
    ===========================================================================
    Sybase Code for proc2
    create procedure proc2
    @param1 int,
    @param2 int out
    as
    begin
    if something exists(select * from table where whereClause)
    select @param2="TRUE"
    else
    select @param2="FALSE"
    select getdate()
    end
    go
    GRANT EXECUTE...
    EXEC sp_procxmode 'dbo.proc2,'unchained'
    go
    ====================================================================
    Code snippet :-
    do {
    int iit=0;
    rs=stmt.getResultSet();
    if ( rs != null ) {
    ResultSetMetaData rsd = rs.getMetaData();
    int nocols = rsd.getColumnCount();
    for (int i=1; i<=nocols; i++)
    System.out.println(rsd.getColumnName(i)));
    while (rs.next())
    for (int i=1; i<=nocols; i++)
    System.out.println(rs.getString(rsd.getColumnName(i));
    } while (stmt.getMoreResults());

    I'm not 100% sure about this, but my guess is that this is caused by the TDS protocol (used by Sybase). TDS makes no difference between the stored procedure you are calling and the "inner" stored procedure, so the driver just returns update counts and result sets as they are generated, regardless of who generated them.
    Another guess (as I don't know what driver you are using) is that execute() returns the first result (update count or ResultSet), as opposed to executeQuery(), which returns the first ResultSet (probably discarding the update count). You can make sure of this by calling getMoreResults(); you should get your ResultSet at some point.
    Alin.

  • Calling Java programs from Oracle Stored Procedure

    Is it possible to call Java programs from Oracle stored procs? If possible Can this be used to exchange data from other applications? Is there a better method/feature in oracle for doing data exchange with other apps?

    If what you mean by Oracle stored procedures is pl/sql then yes.
    You can create a "wrapper" this way:
    CREATE OR REPLACE FUNCTION xmlXform
    in_mapUrl IN VARCHAR2,
    in_inputUrl IN VARCHAR2
    RETURN VARCHAR2
    AS
    LANGUAGE JAVA NAME
    'com.yourcompany.xml2any.xform(java.lang.String,java.lang.String)
    RETURN java.lang.String';
    Then load the java as:
    loadjava -user youruser/youruserpasswd -resolve -verbose lib/xmlparserv2.jar classes/com/yourcompany/xform.class classes/com/yourcompany/xml2any.class
    The java, given the correct permissions, can do anything java can do including communicate with outside applications.
    Is this the "best" way... depends on what you are trying to accomplish.

  • Need Example on calling a unix shell script from oracle stored procedure

    Hi
    Can anybody give example on how to call unix shell script from an Oracle stored procedure. Please give a small example on how to do this .I need this urgently please.
    Have a nice time.
    Thanks & Regards
    Jogesh

    If you are on 10g you can also use DBMS_SCHEDULER. See Re: Excute Unix command Using PL SQL

  • Calling Java Constructor from Oracle Stored Procedure

    Hi all,
    I have come across a situation where on insert into one Oracle database instance, a trigger will be fired which will call a procedure which in turn calls a Java constructor with 2 string arguments(The Java class is loaded into another instance of Oracle using Loadjava).
    (Note: I don't want to call a static method from the Oracle procedure)
    I have seen some examples where in using links, on insertion into a table another table of another instance can also be updated.
    for ex: "INSERT INTO testuser.sal_audit@mainlink VALUES (?, ?, ?)" where "mainlink" is a DB link between the 2 instances.
    Similarly is it possble to call the Java constructor loaded in another instance?
    I have tried in this way. It's not working.
    create or replace procedure pr_Cust_object(FeData varchar2,szDummy varchar2) as
    LANGUAGE JAVA NAME
    'CustomObject@mainLink(java.lang.String, java.lang.String)';
    end pr_Cust_object;
    Expecting help at the earliest--ASAP.
    Thanks and Regards,
    Narendra S K

    I don't know how to do that, but I would be interested in knowing how long each insert/update/delete (which ever the trigger fires on) takes.
    And the logic for rollbacks is probably really interesting.

  • Java versus PL/SQL Stored Procedure Issues

    I am getting a result that is 30 times slower for Java when compared with PLSQL. Can you tell me if that is normal or am I missing something?
    Thanks in advance for your help,
    Gaurav Pal
    Java Developer,
    SCJP 1.1, SCJP 2, SCJD 2
    Timing results
    ---------------- Java ------------------------
    Total Time taken for 10 calls: 4667
    Result: 466 Time: 466
    ---------------- PLSQL ------------------------
    Total Time taken for 10 calls: 150
    Result: 466 Time: 15
    Java Code
    public static int getCursorCount()
    int count = 0;
    //define iterator for select
    count_iter myIter = null;
    try
    #sql myIter = { SELECT lastname FROM employee };
    while(myIter.next())
    count++;
    myIter.close();
    catch(SQLException excp)
    return count;
    PL/SQL Code
    function get_count_cursor_sf
    return
    number
    is
    cursor count_cursor is
    select lastname from employee;
    v_return_count number := 0;
    v_name employee.lastname%type;
    begin
    open count_cursor;
    fetch count_cursor into v_name;
    while (count_cursor%found) loop
    fetch count_cursor into v_name;
    v_return_count := v_return_count + 1;
    end loop;
    --Return the variable
    return v_return_count;
    end ;
    Calling Code
    public class DBCall
    public static void main(String args[])
    try
    makeJavaCalls();
    makePLSQLCalls();
    catch(Exception excp)
    excp.printStackTrace();
    public static Connection getConnection() throws Exception
    Class.forName("oracle.jdbc.driver.OracleDriver");
    return DriverManager.getConnection("jdbc:oracle:thin:@10.0.0.3:1521:oracleee","rda","rdauser");
    public static void makePLSQLCalls() throws Exception
    int count = 10;
    long time = 0;
    int result = 0;
    while(count > 0)
    Connection conn = getConnection();
    CallableStatement cs = conn.prepareCall("{? = call rda_plsql_pkg.get_count_cursor_sf()}");
    cs.registerOutParameter(1, Types.INTEGER);
    long before = System.currentTimeMillis();
    cs.execute();
    result = cs.getInt(1);
    long after = System.currentTimeMillis();
    time = time + (after - before);
    cs.close();
    conn.close();
    count--;
    System.out.println("---------------- PLSQL ------------------------");
    System.out.println("Total Time taken for 10 calls: " + time);
    System.out.println("Result: " + result + " Time: " + (time/10));
    public static void makeJavaCalls() throws Exception
    int count = 10;
    long time = 0;
    int result = 0;
    while(count > 0)
    Connection conn = getConnection();
    CallableStatement cs = conn.prepareCall("{? = call dorknight.getcursorcount()}");
    cs.registerOutParameter(1, Types.INTEGER);
    long before = System.currentTimeMillis();
    cs.execute();
    result = cs.getInt(1);
    long after = System.currentTimeMillis();
    time = time + (after - before);
    cs.close();
    conn.close();
    count--;
    System.out.println("---------------- Java ------------------------");
    System.out.println("Total Time taken for 10 calls: " + time);
    System.out.println("Result: " + result + " Time: " + (time/10));
    null

    A big contributor to the behavior seen here is that there is a one-time overhead per session (= per database connection) to start the JavaVM and also (in 8.1.6 and earlier) to initialize the SQLJ runtime (via reflection).
    Keeping the same connection for subsequent calls to Java (which is the more typical scenario, anyway) will result in a rather considerable speedup.

Maybe you are looking for

  • Does an ipad connect to the internet even if no one turns it on?

    I lost my ipad and put it in lost mode from findmyiphone, but it will not show unless it connects to the internet. How will it connect to the internet if no one can open it? It has a password. Does it automatically do that if I have connected to that

  • Call Stored Procedure in ASP

    Failed to executed the stored procedure when i used the command object in ADO to call the packages' function!!!! the result is --- Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC driver for Oracle]Syntax error or access v

  • Why does office 2011 run slow under mountain lion?

    I was in an Apple Store and launched MS Office (Word or Powerpoint) on a new iMac they had on display.  It was very slow.  I rebooted and repeated the event from cold.  It made no difference.  Is there a problem with M.Lion and Office 2011?

  • Program won't work, can't wait forever for support

    I don't know where else to vent, so here goes.  Here's a message I just emailed to Adobe feedback: I am calling for the 2nd time in 2 days to try to get through to tech support.  As I type this, I have been on hold for 40 minutes. There is apparently

  • How do you run a program on another computer over the network

    Would like to send and receive my aol email and run other applications from my other G4 that I don't have installed in my main computer through the in house network- without opening the application on the main computer. In other words, running the 2n