Search code examples
javasqlubuntufirebirdmonitor

Monitoring SQL calls to Firebird under Ubuntu (Java app)


Having just moved platform from mySQL to firebird I am finding it difficult to find an acceptable way of capturing SQL commands being passed from a Java .jar application to the database server (Firebird). I need to analyse the commands as well as the "cost" of the queries being passed over in terms of execution time and so on.

With MySQL it was possible to use the maatkit toolkit but unfortunately this does not appear to work with Firebird.

Does anyone have an appropriate and comparable approach to maatkit for Firebird? Or using strace or similar?


Solution

  • You can use the Firebird trace facility and its API to produce this information. For details see Trace and Audit Services in the Firebird 2.5 release notes and Audit and Trace Services in Firebird 2.5.

    You can either configure a server side trace session which is written out to a log file, or use the services API to perform a user trace session (depending on your rights you will only see your own queries or everything).

    The firebird installation includes a commandline tool to access the user trace API (fbtracemgr.exe). Jaybird 2.2 contains a rudimentary access to the user trace API, but to be honest it isn't really user friendly yet (and a bit brittle). There are several (commercial) third party tools which access the Trace API in a more user-friendly way: