Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Java Stored Procedure Requirements
Vladimir M. Zakharychev wrote:
>>well, I still think, my way also works.
>>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
"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()' || ' {' || ' }' || '};';
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)Received on Tue Nov 26 2002 - 07:12:47 CST
> 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