MacLochlainns Weblog

Michael McLaughlin's Technical Blog

Site Admin

No Java in Oracle XE

with 3 comments

While helping in the forum, I noticed that folks don’t know that Java isn’t deployed with the Oracle 10g XE. However, it strikes me that you might be able to fudge it but I’m not sure that’s allowed in the EULA. If you want Java inside the database, why wouldn’t you install the licensed product?

There was an OTN article that listed three limitations but this wasn’t one in the article. Maybe I’ll run across the marketing note sometime in the furture or somebody will post the URL as a comment, which is always appreciated.

Anyway, the presence or lack of Java inside the database is pretty easy to test. You only need to do this:

SQL*Plus: Release 10.2.0.1.0 - Production ON Thu Nov 26 21:19:42 2009
Copyright (c) 1982, 2005, Oracle.  ALL rights reserved.
 
Connected TO:
Oracle DATABASE 10g Express Edition Release 10.2.0.1.0 - Production
 
SQL> CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED HelloWorldSQL AS
  2  public class HelloWorldSQL {
  3    public static String hello() {
  4      RETURN "Hello World."; }
  5  }
  6  /
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED HelloWorldSQL AS
*
ERROR at line 1:
ORA-29538: Java NOT installed

This is also true for Oracle Database 11g XE, as shown:

SQL*Plus: Release 11.2.0.2.0 Production ON Fri DEC 9 02:34:20 2011
Copyright (c) 1982, 2011, Oracle.  ALL rights reserved.
 
Connected TO:
Oracle DATABASE 11g Express Edition Release 11.2.0.2.0 - 64bit Production
 
SQL> CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED HelloWorldSQL AS
  2  public class HelloWorldSQL {
  3    public static String hello() {
  4    RETURN "Hello World!"; }
  5  }
  6  /
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED HelloWorldSQL AS
*
ERROR at line 1:
ORA-29538: Java NOT installed

It also explains the lack of loadjava or dropjava from the $ORACLE_HOME/bin directory.

Written by maclochlainn

November 26th, 2009 at 10:34 pm

Posted in Java,Oracle,Oracle XE

3 Responses to 'No Java in Oracle XE'

Subscribe to comments with RSS or TrackBack to 'No Java in Oracle XE'.

  1. “If you want Java inside the database, why wouldn’t you install the licensed product?”

    Well the short answer is I have a copy of the licensed product running on my production and test servers… but the DBAs won’t give us access to create our own tables even in test.

    So I installed XE on my local machine to try and give myself a sandbox where I could try a few things I want to implement on our system, but need to play with before I can confidently design the tables.

    So why do I want java in the DB? Because it’s the only way I’ve been able to find to execute OS commands from within PL/SQL…

    Walter

    2 Apr 10 at 8:00 am

  2. Walt, I understand the problem but Oracle’s opinion is that’s all they want to give away for free. ;-)

    maclochlainn

    2 Apr 10 at 10:21 pm

  3. Think Bfile and java does not work in Oracle 10G Express

    Following found on http://monkeyonoracle.blogspot.com/2009/10/storing-images-outside-oracle-xe-with.html

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    CREATE OR REPLACE PROCEDURE resize_image (
      p_script_name     IN          varchar2
    , p_image_name      IN          varchar2
    ,  p_directory       IN          varchar2
    ) AS
    BEGIN
      dbms_scheduler.create_job(
          'imgres'
        , job_action=>'C:\WINDOWS\system32\cmd.exe'
        , number_of_arguments=>4
        , job_type=>'executable'
        , enabled=>FALSE);
      dbms_scheduler.set_job_argument_value('imgres',1,'/q');
      dbms_scheduler.set_job_argument_value('imgres',2,'/c');
      dbms_scheduler.set_job_argument_value('imgres',3,p_directory||p_script_name);
      dbms_scheduler.set_job_argument_value('imgres',4,p_image_name);
      dbms_scheduler.enable('imgres');
    END;
    /
    GRANT EXECUTE ON sys.resize_image TO someuser;

    Toon

    13 Sep 10 at 12:32 pm

Leave a Reply