Now: Tutorial for Web and Software Design > Database > Oracle > Database Content
> Getting control of the Oracle JavaVirtual Machine [Bookmark it]
Getting control of the Oracle JavaVirtual Machine

JVM Operational Test

The DBA should check the JVM core functionality before developers and end users begin work. For a test we are going to create a Java class, compile it, load it in the database and execute it as a part of PL/SQL block.

Creating Java class:

# vi dbatest.java
public class EchoInput { 
public static void main (String[] args){ 
 for (int i=0; i<args.length;i++) 
 System.out.println(args[i]);}}    

Compile Java class file:

# javac dbatest.java
# ls 
-rw-r--r--   1 oracle   tivdba       132 Apr  2 15:54 dbatest.java
-rw-r--r--   1 oracle   tivdba       429 Apr  2 15:54 dbatest.class

Load Java class dbatest.class in the database:

#  loadjava -u artist/artist -v -r dbatest.class
initialization complete
loading  : dbatest
creating : dbatest
resolver :  
resolving: dbatest

The class is saved in user schema "Artist" and will be wrapped in the PL/SQL. In that way, we are providing a call for the Java stored procedure from the PL/SQL package:

SQL> create or replace procedure dba_test ( s1 varchar2, s2 varchar2 ) as language java name 
'dbatest.main(java.lang.String[])'; 
Procedure created.

As a final step, call to procedure:

SQL> set serveroutput on
SQL> call dbms_java.set_output(5000);
Call completed.
SQL> call dba_test('DBA', 'Test');
DBA
Test
Call completed.

The basic JVM functionality is successfully checked and database is ready to use.

Previous   Next

Prev  [1] [2] [3] [4] [5] [6] [7] Next

[Bookmark][Print] [Close][To Top]
  • Prev Article-Database:

  • Next Article-Database:
  • Related Materias
    Automating ETL using Oracl
    It All Depends on the CONT
    Understanding Oracles Loca
    Using Oracle Locks to Mana
    Returning Rows Through a T
    Document Management with O
    Disk Sorts - A Subtle Thre
    Altering Oracles SQL*Plus 
    So You Want to Use Oracles
    Reporting Database Object 
    Topics
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Graphic Design Tutorial
     

    Coreldraw Tutorial

      Illustrator Tutorial
      3D Graphics Articles
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial&Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial&Articles
     

    XML Style Tutorial

      AJAX Tutorial
      XML Mobile
    Flash Tutorial&Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial&Articles
     

    Linux Tutorial

      Symbian Tutorial
      MacOS Tutorial