Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2004
    Posts
    9

    Question Unanswered: Calling Java Application from PL/SQL code

    Colleagues,

    I am not an expert in PL/SQL neither Java, so I require a help here:

    What I am planning to do is to use PL/SQL to call a Java application (pass 3 arguments).

    The Java application is used to make call to an API that resides on a Bea Weblogic application/web server (it’s not used to access database).

    I got already the PL/SQL Trigger, but I need to add to it the call to the Java application (the Java application already exists)

    Simply, would any one provide an example of how to make that call.

    Do I need to load Java classes into the Oracle database or not…?

    I am using Oracle 9i database, and the Java application is compiled using Java SDK 1.4.2

    Many thanks…

  2. #2
    Join Date
    Jan 2004
    Location
    Hyderabad, India
    Posts
    37
    Hi,

    To call java class from a pl/sql, you need to follow the steps.

    1. First create a java file and compile it.

    2. Load the java class file to the database using 'loadjava' utility.

    Ex: loadjava -u scott/tiger abc.class

    3. Create a pl/sql wrapper aroung the java class like

    CREATE OR REPLACE PROCEDURE test (a1 VARCHAR2) AS LANGUAGE JAVA name 'abc.main(java.lang.String[])';

    4. Then execute the stored procedure

    exec test(<input>);
    Regards
    Suneel

  3. #3
    Join Date
    Nov 2003
    Location
    Bangalore, INDIA
    Posts
    333

    Thumbs up

    HI,

    Invoking the java stored procedures from any PL/SQL block or stored module works the same way it would for any other PL/SQL stored function.

    For example:

    SQLPLUS> set serveroutput on size 5000;

    SQLPLUS> declare
    2> temp varchar2(100);
    3> begin
    4> temp := ConcatTwo('Hello','World');
    5> DBMS_OUTPUT.PUT_LINE(temp);
    6> end;
    7> /
    SATHISH .

  4. #4
    Join Date
    Jan 2004
    Posts
    9

    Cool

    Thanks... suneel.kumar and satish_ct

    you realy give me some ideas...

  5. #5
    Join Date
    Aug 2003
    Posts
    40
    These examples provide the capability to load specific "classes" to the
    database and most will work however Oracle will have problems with
    classes that import from GUI packages such as AWT or Swing.

  6. #6
    Join Date
    Nov 2003
    Location
    Bangalore, INDIA
    Posts
    333

    Thumbs up

    HI,

    Did U come across any such error?
    SATHISH .

  7. #7
    Join Date
    Jan 2004
    Posts
    9

    Smile

    My class is only initiate a request or call to another system API (my class doesn't import from any GUI Packages).

    Many thanks to you all

  8. #8
    Join Date
    Jan 2004
    Posts
    9

    Unhappy

    when I've tried to load the java class, but I got the following error:

    ORA-04031: unable to allocate 4032 bytes of shared memory ("shared pool","unknown object","joxs heap init","ioc_allocate_pal")

    would some one told me what I should do.

    I think that the shared pool is out of memory so should I consult the DBA, system Admin or is it from my PC, where I am making a conection to the server/Database.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •