Remote Debugging PL/SQL using JDeveloper

 

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:

DBMS_DEBUG_JDWP.CONNECT_TCP(host, port);

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.)



Enjoy,

Shay.

 

Comments:

With the 'Listen to JPDA' I cannot start the remote debugger. It gives me the message "Debugger is not able to listen for JPDA using the specified parameters." Wondering what is that I need to do to fix this.

Posted by Srikumar on March 24, 2006 at 07:20 AM PST #

I answered the OTN thread for this: http://forums.oracle.com/forums/thread.jspa?messageID=1251527

Posted by Shay Shmeltzer on March 27, 2006 at 06:30 AM PST #

Back on orablogs version of this blog somebody asked: > Is there an easy way to set up integrated > debugging between a Java application and > PL/SQL. A proof of concept of a debugger (using JPDA and Eclipse) for combined call stack debugging of Java and PL/SQl, see http://db-db.sourceforge.net

Posted by Gregory Golberg on November 27, 2006 at 09:22 AM PST #

The nice thing with JDeveloper is that it works already - you can combine Java debugging with PL/SQL debugging and step into pl/sql from your java debug session.

Posted by Shay Shmeltzer on November 27, 2006 at 09:46 AM PST #

What will happen if don't give DBMS_DEBUG_JDWP.disconnect after DBMS_DEBUG_JDWP.CONNECT_TCP( ip, port )....

Posted by Vivek V R on April 08, 2008 at 01:41 AM PDT #

Any grant required to enable remote debug???

Posted by Vivek V R on May 13, 2010 at 08:15 PM PDT #

You need to be able to execute things from this package: DBMS_DEBUG_JDWP

Posted by shay.shmeltzer on May 14, 2010 at 07:59 AM PDT #

Is it possible to use this method to debug a PLSQL package in zipDB ? If yes, will you be able to provide some pointers on how to go about it ?

Posted by Ashish Vardhan on December 28, 2010 at 11:14 PM PST #

Ashish, I'm not familiar with zipDB. I guess it depends on whether that database supports JPDA connection.

Posted by shay.shmeltzer on December 30, 2010 at 01:49 AM PST #

Hi,
We have a Java program calling Pl/SQL packages.

I am able to configure and debug the java program using JDeveloper.
But the debugger is not entering the PL/SQL packages break points.

Can you please help on this. There is no documentation available for configuring Pl/SQL packages from Java programs.

I am able to debug pl/sql packages from SQLPLUS using the DBMS_DEBUG_JDWP.CONNECT_TCP(host, port); But can we do the Pl/SQL package debugging from the java program without using the above DBMS statement.

Thanks for your help

Posted by shiva on May 02, 2012 at 06:37 AM PDT #

Hi,
I was able to debug the Pl/SQL from java , by putting the statement
DBMS_DEBUG_JDWP.CONNECT_TCP(host, port); inside the PL/SQL Package.

Thanks
Shiva

Posted by shiva on May 04, 2012 at 06:29 AM PDT #

https://blogs.oracle.com/shay/resource/viewlet/plsql_remote_debugging.swf - the page does not show the video. some junk stuff.

Posted by guest on July 09, 2012 at 02:27 AM PDT #

thanks for the note - try this URL - https://blogs.oracle.com/shay/resource/viewlet/plsql_debug.html

Posted by Shay on July 09, 2012 at 09:09 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

me
I'm a Director of Product Management for the Oracle Java Development Tools.
Follow me:
Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today