尝试从 Oracle 数据库导出 java 源代码

发布于 2024-08-26 02:19:01 字数 499 浏览 6 评论 0原文

我正在尝试使用以下代码从 Oracle 数据库导出 java 对象的源代码。

DECLARE
  blob1 BLOB;
BEGIN
  DBMS_LOB.CREATETEMPORARY(blob1, FALSE);
  DBMS_JAVA.EXPORT_SOURCE('OBJECTNAME', 'SCHEMANAME', blob1);  
END;

每当我尝试运行它时,我都会收到此异常:

oracle.aurora.rdbms.ModifyPermissionException

即使我以 System.任何想法是什么导致了这个以及我如何让它发挥作用。

经过更多研究后,它在以 sysdba 身份运行以及以拥有对象的用户身份运行时有效。不幸的是,我正在编写一个程序来转储 Oracle 数据库中的 java 对象,并且我无法真正强制我的用户成为 sysdba 或对象的所有者。

有什么办法可以阻止这个错误吗?

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.

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

肤浅与狂妄 2024-09-02 02:19:01

连接时使用“as sysdba”选项。当我以 sysdba 身份登录时,我没有收到 ModifyPermissionException。请参阅下面我的操作。我得到的 ORA-29532 是因为我的数据库中根本没有 Java 类。让我知道它是否对你有用。

C:\Documents and Settings\KrassimirB>sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Mar 18 15:58:10 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> connect sys/oracle@orcl as sysdba
Connected.
SQL> @C:\tmp\java_export.sql
  7  /
DECLARE
*
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java.sql.SQLException: no such java schema object
ORA-06512: at "SYS.DBMS_JAVA", line 182
ORA-06512: at line 5


SQL>

When you connect use "as sysdba" option. I don't get ModifyPermissionException when I login as sysdba. See my actions below. The ORA-29532 I am getting is becuse I simply don;t have the Java class in my database. let me know if it worked for you.

C:\Documents and Settings\KrassimirB>sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Mar 18 15:58:10 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> connect sys/oracle@orcl as sysdba
Connected.
SQL> @C:\tmp\java_export.sql
  7  /
DECLARE
*
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java.sql.SQLException: no such java schema object
ORA-06512: at "SYS.DBMS_JAVA", line 182
ORA-06512: at line 5


SQL>
魂归处 2024-09-02 02:19:01

我面临着同样的问题,但在谷歌上进行了一些搜索后我解决了它。可能会帮助某人。

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;

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;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文