How to drop java source from Oracle database properly

javaoracleplsql

I'm a little stuck here with my Java Source. First I want completly drop it from the database, because I want to recompile it, but I can't drop is, because if I execute this command:

drop java source "SCHEMA.JAVASOURCENAME";

I get this error:

ORA-04043: object JAVASOURCENAME does not exist

The Javasource itself has this structure (this is the plsql/java code for it):

create or replace and compile java source named myjavasource as

import java.io.*;
import some.custom.jar.one.*;
import some.custom.jar.two.*;
import some.custom.jar.three.*;

    public class MyJavaClass
    {
      public static String myjavafunction(String connectString, String identity, String password)
      {
       ...
      }
    }

I executed this "create or replace and compile java source…" command as DBA and with my user as well, I don't know if this can be the problem.

So my question is, how can I drop this java source?

My second question is who can I handle the custom jars? I imported them with this command:

call dbms_java.loadjava('-genmissing -r -v -force -grant SCHEMA ./some.custom.jar.one.jar');

I also executed this as DBA and with my user. If is check the invalid objects:

SELECT *
    FROM user_objects
    WHERE object_type like '%JAVA%'
    AND status = 'INVALID'

as DBA I see the whole world invalid (lot of Java classes), but when I check this as user I only get the javasource and the java class name in the invalid list (I think it needs some more external jars, what I can't find right now).

So, why is the invalid java object list different as DBA and as user? Do I need to execute the Java source creation and the jar imports as DBA (and ONLY with DBA), or with the database user if I want to use it (the java funtion, what is using the external jars) with all schema users?

Thank you very much!

Best Answer

Each element of a name must be quoted individually:

drop java source "SCHEMA"."JAVASOURCENAME";

The identifier "SCHEMA.JAVASOURCENAME" refers to a java source name SCHEMA.JAVASOURCENAME in the current schema, e.g. "VORIAND"."SCHEMA.JAVASOURCENAME"