How to debug Java Stored Procedures in Oracle

爷,独闯天下 提交于 2020-01-13 18:58:48

问题


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


回答1:


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.




回答2:


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.

javac $JAVA_OPTS -g file_names

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.




回答3:


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



来源:https://stackoverflow.com/questions/5665984/how-to-debug-java-stored-procedures-in-oracle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!