Remote Debugging PL/SQL using JDeveloper
By Shay Shmeltzer-Oracle on Dec 20, 2005
I always find myself a little surprised when I show people that we can do PL/SQL debugging in JDeveloper and they say "we didn't know you can do it". I just realized that if "normal" PL/SQL debugging is a hidden feature of JDeveloper, then you can probably count the number of people that know that we also can do remote debugging of PL/SQL on the fingers of your hand.
So here we go with the 2 minutes explanation of how to remote debug PL/SQL using JDeveloper.
For those not familiar with the concept of remote debugging - basically it means that you set a break point on in your PL/SQL code inside JDeveloper, and then you wait for someone to invoke the code from whatever application - and you are able to debug the code as it was invoked from his environment (parameters and all).
Basically you need to set up an empty project in JDeveloper and in its properties under the run/debug properties set it to do remote debugging and also to "Listen to JPDA" (edit the run configuration for this).
Then you set a breakpoint in your favorite PL/SQL code.
The tricky part now is that whoever needs to invoke the code needs to set his session to send info to your waiting debugger.
You do this by running the following PL/SQL procedure:
in the case you run this all on your own machine you can use:
DBMS_DEBUG_JDWP.CONNECT_TCP( '127.0.0.1', 4000 );
Then you just invoke the code and JDeveloper will stop at your break point.
If this explanation sounds a bit complex here is a 2 minute demo that will show you exactly how to do it.
(You might want to press F11 to maximize your viewing area.)