Using the command line utility loadjava , the JAVA library was loaded into the database. Command with parameters:

loadjava -jarsasdbobjects -resolve -verbose -thin -user login/pass@host:port:SID "sqljdbc.jar" 

Now I try to delete this library as follows:

 dropjava -jarsasdbobjects -resolve -verbose -thin -user login/pass@host:port:SID "sqljdbc.jar" 

To which I get an error:

 dropping: class com/microsoft/sqlserver/jdbc/ActivityCorrelator Error while dropping com/microsoft/sqlserver/jdbc/ActivityCorrelator ORA-29537: класс или ресурс не могут быть созданы или удалены напрямую 

And so for every class in this library.

I tried to delete with dbms_java.dropjava() and through the drop java class , but the error was still the same.

It must be said that the library loaded without the -jarsasdbobjects parameter was -jarsasdbobjects without problems.

How do I properly remove the library?

    1 answer 1

    TL; DR: Full error message:

     $ oerr ora 29537 

    29537, 00000, "class or resource cannot be created or dropped directly"
    // * Cause: Java class or resource
    // is a Java source object.
    // * Action: Acting
    // the source of this or that.

    You cannot create or delete a Java class that is the result of compiling an existing Java object with source code ( object_type='JAVA SOURCE' ).


    A viable example:

     $ echo "public class SomeClass { }" >SomeClass.java $ javac SomeClass.java $ jar -cvf SomeClass.jar SomeClass.class $ connstr="user/pass@dbserver/sevice" $ loadjava -u $connstr -r -v SomeClass.jar resolving: class SomeClass Classes Loaded: 1 $ dropjava -u $connstr -v SomeClass.jar dropping: class SomeClass 

    So far so good, but after:

     $ sqlplus -l -s $connstr <<+++ create or replace and compile java source named SomeClass as $(<SomeClass.java) / +++ Java created. 

    an object with the source code will be created, and attempts to create or delete a class with the same name as defined in the source code will fail:

     $ loadjava -u $connstr -r -v SomeClass.jar Error while creating class SomeClass ORA-29537: class or resource cannot be created or dropped directly $ dropjava -u $connstr -v SomeClass.jar Error while dropping SomeClass ORA-29537: class or resource cannot be created or dropped directly 

    You must first remove the object with the source code and then everything will work again:

     $ sqlplus -l -s $connstr <<+++ drop java source SomeClass; +++ Java dropped. $ loadjava -u $connstr -r -v SomeClass.jar resolving: class SomeClass Classes Loaded: 1 $ dropjava -u $connstr -v SomeClass.jar dropping: class SomeClass