Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Java Stored Procedure Requirements

Re: Java Stored Procedure Requirements

From: Matthias Rogel <rogel_at_web.de>
Date: Tue, 26 Nov 2002 14:12:47 +0100
Message-ID: <arvs0h$lnhuk$1@ID-86071.news.dfncis.de>


Vladimir M. Zakharychev wrote:

>>well, I still think, my way also works.

>
>
> Unlikely.
>
>
>>Jane, I don't know what you want to do exactly, but
>>if you are using a language which supports exception-handling
>>(like PL/SQL, Java, Delphi, ...),
>>just do this:
>>
>>Pseudocode
>>
>>try
>>     blablabla   // invoke Java Stored procedure on server
>>exception       // find out which exception to catch
>>when Java_Stored_procedure_on_server_is_not_supported then
>>     error('Java Stored procedure on server is not supported');
>>end;

>
>
> The question was not if one can call a Java SP, but what are the
> prerequisites to be able to *create* one. Your approach will not

the question was
"How do I find out if I can do Java Stored Procedure on a server ?" which may be interpreted in many ways ...

with my approach,

begin

    execute immediate

     'create or replace and compile java source named b as ' ||
     'public class B' ||
     '{' ||
     '   public static void nothing()' ||
     '   {' ||
     '   }' ||
     '};';

    execute immediate
    'create or replace procedure b_ ' ||     'as LANGUAGE JAVA NAME ''B.nothing()'';'; exception when others then

      null;

--
--  ... you cannot *CREATE* Java SP, add your code here
--
end;

works quite good to determine if I am able to *create* one.
(The example in PL/SQL can be easily ported to any other
exception-supporting language which can connect to ORACLE)


> work as you first have to create Java SP and only then you can
> try to call it - and if your Oracle instance is not Java-enabled, then
> you will fail on create step and will never come to trying that
> procedure. Avi gave correct answer to the original question, though
if the create step fails, the question is answered, so there is no need in trying something anymore.
> there also is another way to verify if Oracle VM is ok:
>
> select count(*) from all_objects where object_type like 'JAVA%';
>
> should return more than 4000 (could be 9000+, depending on
> options loaded.) This query checks if JDK classes are all loaded
> and registered and is used internally in one of initjvm.sql
> subscripts for sanity check.
>
>
this heuristic is not so good: you still know nothing for instance about grants you are given and initialization parameters for the ORACLE instance which may detain you from creating Java SP. Matthias
Received on Tue Nov 26 2002 - 07:12:47 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US