Database Connections

The database wizard needs to be connected to a database, by way of a JDBC connection. It is anticipated that the production JDBC driver used is the same as the one used with the wizard. However, the nature of the wizard makes the target driver almost irrelevant. This is because most settings, which determine how the code is generated, can be configured and saved in the project file.

In order to use a JDBC driver other than the JDBC-ODBC bridge, the Wizard needs to be started with the and entry in the CLASSPATH for the driver. Or the driver's classpath can be specified by pressing the Edit... button.

For example. below is an example shell script (BAT) file used to launch the wizard:

cd temp
java -cp E:/data/code/JDBCDrivers/lib;C:/temp/J3Wizard.jar com.j3.swingUI.Main

The test button allows a JDBC driver classname to be tested. When the button is pressed the wizard attempts to load the class. If this fails it is for one of two reasons:

  1. The class name is spelt incorrectly
  2. The classpath has not been set to point at the JDBC driver

When the wizard successfully connects to the database, the connection details are automatically saved in the project file.

By default the password is not saved to the project file. If you would like to save the password, the "Save Password" checkbox needs to be checked, before a connection is made. Note that the password may be visible to people who examine the project file.

The Edit button pops up a dialog to set the JDBC driver's classpath:

To Connect Or Not?

When opening an existing project, it is possible to work with it while not being connected to the database.

When disconnected the wizard will not try to introspect the database, and so it can only display the information that was gathered during previous connections. For this reason some information may appear incomplete (for example tables and columns may not be visible).

If all you wish to do is regenerate a set of classes, connection is not required. If, however you wish to create new classes, it may be wise to connect first. Database scanning can be controlled to avoid lengthy database introspection, as discussed in the next section.

Database Scanning

Some databases can be very large. An experienced user can turn on, and off, database scanning at will:

The current status is also displayed in the status bar, at the bottom right corner of the Wizard's window.

The database is connected, but the wizard does not perform introspection. The wizard will query the database only when verifying classes. Class verification is explained in the following link.

The database is connected, and the wizard performs introspection

The wizard is not connected to the database. It is not possible to perform database introspection, nor can classes be verified against the live database.

Most parts of the database can be scanned by switching scanning on, then collapsing the relevant node in the tree control, then expanding the relevant node in the tree control.

It is worth noting that the database types are not introspected repeatedly. Hence a fresh project file should be allowed to scan the DATABASE object at least once, when the project file is first created.

Copyright © 2002 J3 Limited, all rights reserved.