When to Use the Visual J++ 1.1 Database Wizard

Jay Cross and Al Saganich
Authors of Visual J++ 1.1 Sourcebook

Are you converting to the Web paradigm? Do you need to convert a large complex graphic user interface (GUI) to applets on web pages? As with anything useful in this world, this job will take several steps. At some point, while progressing through your design, you will have to decide how to interact with the backend database. Enter the Visual J++ Database Wizard!

For Web surfers using Microsoft Internet Explorer, it is a reasonable to craft the front end using data access objects (DAOs) or remote data objects (RDOs). These objects and their methods are well documented in the Visual J++ InfoView library, but for most people who are just getting started, even after reading (or in some cases skimming) these digital tomes, there still is a cloud of doubt surrounding the effort. This uncertainty stems from not knowing which methods to call first, how to specify parameters in the DAO and RDO methods, or even how to capture and display that data in the Java applet. This is when most successful developers go looking for a working example to imitate.

Salvation is available in the form of the Visual J++ Database Wizard. Invoke the wizard when creating a new project. It is easy to find, right along with the Java Applet Wizard and the Java Project Wizard (for creating full-fledged applications). The Database Wizard walks you through a set of four data-gathering pages that collect the information required to build a database applet (which also has the parts necessary to be a stand-alone application). This applet displays the data from the columns specified from a table, one row at a time. The applet may have update privileges, or you may make it read-only. It may use DAO (to connect to Microsoft Access) or RDO. And, of course, you may connect to any database you have access to (using ODBC or other available driver support). And that’s pretty much all there is to it!

Figure 1. A sample Applet created with the Java Database Wizard

Of course, any real-world application you are developing will need to have data from tables accessed via foreign keys (in a choice box perhaps), or nontext data that should be displayed, perhaps with radio buttons. You might want to set the order of fields being displayed or devise a layout for the data displaying components (controls) in your applet. You may want to go beyond single tables and display data from a stored procedure or a query ResultSet. While the Visual J++ Database Wizard does not provide these functions directly (you were expecting Java versions of the Microsoft Access Database Wizards perhaps?), it produces 870 lines of well-written working Java code that uses the DAO or RDO methods in a clean, straightforward fashion. All you need to do is jump in and add your own extensions!

With these thoughts in mind, you will find the Visual J++ Java Database Wizard for Java very useful development tool. Simply stated, a great starting point for building database-enabled web applications.