X

Shay Shmeltzer's Oracle Development Tools Tips

  • December 20, 2005

Remote Debugging PL/SQL using JDeveloper

Shay Shmeltzer
Director of Product Management - Oracle

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.


Join the discussion

Comments ( 13 )
  • Srikumar Friday, March 24, 2006
    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.
  • Shay Shmeltzer Monday, March 27, 2006
    I answered the OTN thread for this: http://forums.oracle.com/forums/thread.jspa?messageID=1251527
  • Gregory Golberg Monday, November 27, 2006
    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
  • Shay Shmeltzer Monday, November 27, 2006
    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.
  • Vivek V R Tuesday, April 8, 2008
    What will happen if don't give DBMS_DEBUG_JDWP.disconnect after DBMS_DEBUG_JDWP.CONNECT_TCP( ip, port )....
  • Vivek V R Friday, May 14, 2010
    Any grant required to enable remote debug???
  • shay.shmeltzer Friday, May 14, 2010
    You need to be able to execute things from this package: DBMS_DEBUG_JDWP
  • Ashish Vardhan Wednesday, December 29, 2010
    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 ?
  • shay.shmeltzer Thursday, December 30, 2010
    Ashish, I'm not familiar with zipDB. I guess it depends on whether that database supports JPDA connection.
  • shiva Wednesday, May 2, 2012

    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


  • shiva Friday, May 4, 2012

    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


  • guest Monday, July 9, 2012

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


  • Shay Monday, July 9, 2012
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha