Xaprb

Stay curious!

Stored procedure debugging in MySQL

with 6 comments

I was just skimming through the latest “Meet the Experts” podcast from Oracle, whose topic is debugging stored routines in MySQL. The tl;dr (tl;dl?) version is if you’re working with Windows and .NET, you can install a Visual Studio plugin that lets you debug stored routines in the server via the .NET connection libraries. That’s pretty nice, for those who are using that platform. The podcast is only a few minutes, so if you’re interested, by all means listen to it, or take a look at the documentation.

The ideal way to debug stored routines would be an API in the server, but that doesn’t exist. Nevertheless, I remembered having seen some sort-of implementations of debugging at times in the past. My memory was that they used some workarounds to inject debugging code into the routines, using some things like special tables to communicate the values of variables and so on. I searched my quick-snippets file and did a brief web search, and turned up a lot more options than I remembered! In addition to the feature explained in the Oracle podcast, these products also offer stored procedure debugging of one type or another:

I haven’t used any of the above, and I’m not endorsing them, but I thought it might be helpful to have a list in one place. Did I miss any? Please add more information in the comments.

Written by Xaprb

November 1st, 2012 at 9:08 pm

Posted in SQL

6 Responses to 'Stored procedure debugging in MySQL'

Subscribe to comments with RSS

  1. I’ve used dbForge and it worked well. There were a few caveats and limitations, but it handled the complex recursive stored procedures I was working on at the time.

    Justin Swanhart

    1 Nov 12 at 9:53 pm

  2. @Baron ..

    It is rather “Stored procedure debugging in MySQL?” and not “Stored procedure debugging in MySQL”. The difference is a question mark! :-)

    Lots of good questions. No proper answer yet! And that is too bad IMO.

    refer:
    http://blog.webyog.com/2011/12/06/debugging-stored-programs-in-mysql/

    Peter Laursen

    2 Nov 12 at 8:28 am

  3. Sorry .. I forgot one detail:

    What I saw years back are rather ‘emulators’ than ‘debuggers’.

    If a debugger “use some workarounds to inject debugging code into the routines” .. then it matters a lot if the routine only executes SELECTS or also INSERT/UPDATE/DELETES, DDL statements and changes configuration during runtime.

    An ‘emulator’ will replace physical tables with temporary tables, locally declared variables with user variables etc. in order not to touch the “real” data.

    Peter Laursen

    2 Nov 12 at 8:46 am

  4. Hi Baron,
    We have an open-source debugger for MariaDB/MySQL.
    http://h71028.www7.hp.com/enterprise/cache/600004-0-0-0-121-MDbug.html
    Download from https://launchpad.net/mdbug/trunk.
    We’re fairly quiet about it because it’s early alpha, only the low-level (“gdb like”) part operates, and it will be a while before work resumes. But you can get the idea of how it works from the documentation, debugger.txt and debuggercore_manual.txt.

    Peter Gulutzan

    6 Nov 12 at 9:01 pm

  5. I have implemented a server-side debugger & debugging API for MySQL stored routines, called “rdebug” as part of common_schema.

    Here’s a quick tutorial.

    It’s released under GPL, and currently non-GUI. Hopefully someone will venture to code an Eclipse plugin or whatever, that uses this API. However I should note that it is operational by command line; the GUI will only be a wrapper.

    Shlomi Noach

    10 Apr 13 at 1:18 pm

  6. (seems like previous comment is lost)

    I’ve just released rdebug: debugger and debugging API for MySQL stored routines, as part of common_schema.

    This is a server-side solution, which uses code injection to turn one’s routines in to “debug mode”.

    It is GPL, in alpha stage, and a quick walk-through is here.

    I’m happy to receive any feedback on this.

    Shlomi Noach

    10 Apr 13 at 2:05 pm

Leave a Reply