Monitoring database connections

Database application development is a feature of JBuilder Professional and Enterprise. Distributed application development is a feature of JBuilder Enterprise.

JBuilder provides a JDBC monitoring class which can monitor JDBC traffic. JBuilder provides a user interface, invoked from Tools|JDBC Monitor, to work with this class at design time. For information on using this class at run time, see "Using the JDBC Monitor in a running application".

JDBC Monitor will monitor any JDBC driver (i.e., any subclass of java.sql.Driver) while it is in use by JBuilder. The JDBC Monitor monitors all output directly from the JDBC driver.

Understanding the JDBC Monitor user interface

To start the JDBC Monitor, select Tools|JDBC Monitor. The JDBC Monitor displays:

JDBC Monitor

How to use the JDBC Monitor:

  1. Click the JDBC Monitor window's close button to close the JDBC Monitor.
  2. Select text in the log area by highlighting it with the mouse or keyboard.
  3. Click the Save To File button to save the selected text (or all text, if nothing has been selected) to a file.
  4. Click the Clear Log button to clear the selected text (or all the text, if nothing has been selected).
  5. Click the Enable Log Output check box to enable/disable log output.
  6. Click the Log Size button to set the maximum amount of logging information to keep (8K by default).
  7. With the cursor in the text area, press F1 or the Help button to display JDBC Monitor help. Help is available in design mode only.

Using the JDBC Monitor in a running application

To monitor database connections at run time, a MonitorButton or a MonitorPanel must be included with the application. MonitorButton is a Java bean which allows you to run the JDBC monitor against a running application. To do so, the instance of the JDBC monitor in use must be brought up by the application. An instance of the JDBC Monitor brought up from the IDE will only monitor database activities during design time. Pressing the Monitor button displays a dialog containing the JDBC Monitor.

The MonitorPanel can be used to place the monitor directly on a form. It has the same properties as the MonitorButton.

Adding the MonitorButton to the Palette

The MonitorButton can be put on the component palette by following these steps:
  1. Select Tools|Configure Palette.
  2. Select Data Express from the Pages field on the Pages tab.

  3. Select the Add Components tab.

  4. Select JBCL in the Select Library field.

  5. Click Install.

  6. Browse to com.borland.jbcl.sql.monitor.MonitorButton.

  7. Click OK to close the dialog.

Using the MonitorButton Class from code

When the MonitorButton is added to the palette, it can be dropped on to your application. You could also add an instance of the MonitorButton in code, as follows:
	MonitorButton monitorButton1 = new com.borland.jbcl.sql.monitor.MonitorButton();
	this.add(monitorButton1);

Understanding MonitorButton properties

The following component properties are available on MonitorButton to control the default state of the monitor:

Property Effect
outputEnabledTurns Driver trace on/off.
maxLogSize Maximum trace log size. Default is 8K.