Debugging with SQL Monitor

From InterBase

Go Up to Developer's Guide


Use the TIBSQLMonitor component to monitor the dynamic SQL that passes through the InterBase server. You can write an application that can view only its SQL statements, or you can write a generic SQL monitor application that monitors the dynamic SQL of all applications built with InterBase Express (IBX).

Use the TIBSQLMonitor component to watch dynamic SQL taking place in all InterBase data access applications both before and after they have been compiled.

SQL monitoring involves a bit of overhead, so you should be aware of the following:

  • If no SQL monitors are loaded, there is little to no overhead.
  • SQL monitoring can be switched off globally by an application to ensure that it does not get bogged down during debugging.
  • Disabling monitoring in an application that does not require it further reduces the overhead.

Building a Simple Monitoring Application

To build a simple SQL monitoring application, follow these steps:

  1. Open a new form in Delphi.
  2. Add a Memo component to the form and clear the Lines property.
  3. Add a TIBSQLMonitor component to the form
  4. Double-click the OnSQL event and add the following line of code:
     Memo1.Lines.Add(EventText); 
  5. Compile the application.

You can now start another IBX application and monitor the code.

Advance To: