where does system.out.println output goes in oracle java class

前端 未结 2 1577
孤城傲影
孤城傲影 2021-01-04 18:30

I have loaded a java class into oracle using loadjava utility

This class has some system.out.println messages.

When I execute a method from this class I want

2条回答
  •  长情又很酷
    2021-01-04 18:43

    An Oracle article provides some useful info.

    Quote:

    Your class:

    public class SimpleJava {
       public void main(String[] args) {
          System.out.println("Here we are");
        }
    }
    

    Now, compile and load your class:

    C:\oracle9i\bin>javac SimpleJava.java
    C:\oracle9i\bin>loadjava -user scott/tiger SimpleJava.class
    

    From SQL*Plus, create the PL/SQL wrapper to invoke the newly loaded Java class:

    SQL> create or replace procedure call_simplejava
      2  as language java
      3  name 'SimpleJava.showMessage()';
      4  /
    

    Execute the code from SQL*Plus:

    SQL> set serveroutput on;
    SQL> call dbms_java.set_output(50);
    

    Call completed.

    SQL> execute call_simplejava;
    Here we are
    

提交回复
热议问题