如何在 Oracle 中调试 Java 存储过程
我有一个 Oracle 数据库,其中存储了 java 过程,我时不时地加载新过程。
我希望能够使用与将应用程序服务器设置为调试模式相同的调试方法来调试这些 java 程序。
是否可以?我怎样才能做到这一点?
谢谢
I have an Oracle Db with stored java procedures, which I load new procedures here and then.
I would like to be able to debug these java procedures, with a same debug methodology like setting the App server in Debug mode.
is it possible? how can I do that?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Oracle JDeveloper 支持调试 Java 存储过程。您将需要使用 -g 选项编译 java 类,以便在类文件中生成调试信息,即
之后,您将需要编写一个调用此 java 存储过程的虚拟 pl/sql 包过程。然后右键单击 pl/sql 过程名称并选择“调试”。
之后,您可以单步调试 pl/sql 和 java 代码,就像调试常规 java 类一样。由于您使用 -g 选项编译了 java 类,因此您可以监视变量、计算表达式等。如果您没有使用 -g 选项,您仍然可以在调试器中单步执行代码,但您将无法能够观察变量/表达式。
The Oracle JDeveloper has support for debugging java stored procedures. You will need to compile the java classes using the -g option so that the debugging information is generated in teh class files, i.e.
After that, you will need to write a dummy pl/sql package-procedure that invokes this java stored procedure. Then right click on the pl/sql procedure name and select 'Debug'.
After that you can step through the pl/sql and java code just as if you were debugging a regular java class. Since you compiled the java class using the -g option, you can watch variables, evaluate expressions etc. If you didn't use the -g option, you will still be able to step through the code in the debugger, but you will not be able to watch the variables/expressions.
我想你会想要使用 JDeveloper 你也可以用于调试应用程序服务器。它不像几乎任何其他 IDE 那样好,但它对于调试任务来说已经足够好了。
I think you'll want to use JDeveloper which you can also use to debug the app server. It's not as good an IDE as, well, almost any other IDE, but it works well enough for debugging tasks.
另一种选择是使用 Java 日志框架。
然后,您可以将logging.properties和指定的处理程序复制到文件夹ORACLE_HOME/javavm/lib中
Another option is to use the Java Logging framework.
You can then copy logging.properties, with your specified Handler into the folder ORACLE_HOME/javavm/lib