尝试从Oracle数据库导出Java源代码 [英] trying to export java source code from an Oracle database
问题描述
我正在尝试使用以下代码从oracle数据库中导出Java对象的源代码.
I am trying to export the source for a java object from an oracle database using the following code.
DECLARE
blob1 BLOB;
BEGIN
DBMS_LOB.CREATETEMPORARY(blob1, FALSE);
DBMS_JAVA.EXPORT_SOURCE('OBJECTNAME', 'SCHEMANAME', blob1);
END;
每当我尝试运行它时,都会出现此异常:
Whenever I try to run it, I get this exception:
oracle.aurora.rdbms.ModifyPermissionException
即使我以系统身份运行.任何想法是什么原因造成的,以及如何使它起作用.
even though I am running as System. Any ideas what is causing this and how I can get this to work.
对于以sysdba和拥有对象的用户身份运行时,它的工作情况进行了更多研究.不幸的是,我正在编写一个程序来转储Oracle数据库中的Java对象,并且我不能真正强迫我的用户成为sysdba或该对象的所有者.
Having investigated a bit more it worked when running as sysdba and also as the user that owns the objects. Unfortunately I am making a program to dump out the java objects in an Oracle database and I can't really force my users to be sysdba or the object's owner.
有什么办法可以阻止此错误?
Is there any way I can stop this error?
推荐答案
我也遇到了同样的问题,但是在Google上进行了几次搜索后,我解决了.可能会帮助某人.
I am facing the same problem, but after a few searches on google I solve it. Probably will help someone.
DECLARE
b CLOB;
c varchar2(2000);
i integer:= 255;
begin
DBMS_LOB.createtemporary(b, false);
DBMS_JAVA.export_resource('<object_name>', '<schema_name>', b);
DBMS_OUTPUT.PUT_LINE('java_resource:');
DBMS_LOB.read(b, i, 1, c);
DBMS_OUTPUT.PUT_LINE(c);
end;
这篇关于尝试从Oracle数据库导出Java源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!