HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML

So there it is - the opportunity of a lifetime. It seems that the local public utilities commission has allocated a hefty budget to a new project. They want to be able to "link" all of their users in the county utilities building to the same database. All they need is a good database administrator to come in and make it happen.

This appears to be a pretty cut-and-dried job on the surface, but when you arrive you are horrified to learn that all is not as it seems. Most of the office employees are on a Windows NT network, the engineers upstairs need their UNIX system and, to make matters worse, Bessie down in records in the basement won't part with her Mac. (This truly is a government operation!)

The development of database applications that must run on many different platforms points to one solution: Java! This is okay if you're a proficient Java programmer, but what if you're not? Fear not! Your problem is solved with ROAD:BeanBox from Specialized Software International.

ROAD:BeanBox creates Java applications on the fly that will access data from JDBC-enabled database servers. It contains a rich set of data-access components and data-aware user interface (UI) components implemented in Java, using JavaBeans 1.0 technology. Best of all, advanced programming knowledge isn't required to use it.

Installation of ROAD:BeanBox
ROAD:BeanBox runs on any JDK1.1 Virtual Machine or browser. The actual installation procedure varies depending on the software that's to be used with it. I experimented with ROAD:BeanBox in two ways. I tried using it with the JDK1.1.5 and then with Visual Café.

Figure 1

The version of ROAD:BeanBox I used was packaged on CD-ROM as a JAR file. When using the product with JDK 1.1.5, installation consisted of the following steps:

  • Make a directory on the hard drive with an appropriate name. (I called mine BeanBox, of all things!)
  • Copy the appropriate JAR file from the CD-ROM to that directory. In this case the file copied is called "bbox.jar".
  • Ensure that the CLASSPATH variable has been modified to point to this JAR file (for example: CLASSPATH=%CLASSPATH%;C:\BeanBox\bbox.jar.
A great feature of ROAD:BeanBox is that, in addition to the JDK, it works with some GUI-based IDEs as well. I had pretty good results using it with Visual Café. To install ROAD:BeanBox through Visual Café, follow these steps:
  • Make sure Visual Café is installed and operating properly.
  • Launch Visual Café.
  • Create a new project by selecting the "Empty Project" template from the "New Project" dialog box.
  • From the "Insert" menu select the option "Component into Library."
  • Select the bbox.jar file. Click "OPEN" to begin importing.
  • From the "Tools" menu select "Environment Options."
  • Switch to the "Component Palette" tab.
  • Select ROAD:BeanBox from the "Available components" list and click on the "Add" button.
  • Click the "OK" button to save the changes.

The Application Wizard: Your Key to Quick Results
At this point I'd like to strongly recommend the installation and use of the Application Wizard. ROAD:BeanBox seems to work best through the wizard. To install this Wizard when working with JDK1.1.x, take the following steps:

  • Be sure you have properly installed Road:BeanBox.
  • Copy the file "appwiz.jar" to the directory you created when originally installing ROAD:BeanBox.
  • Change your CLASSPATH variable to point to this file. Mine looks like this: CLASSPATH=%CLASSPATH%;C:\BeanBox\bbox.jar;C:\BeanBox\appwiz.jar.
Installation of the Application Wizard through Visual Café is much the same as it is with the JDK:
  • Create a "BeanBox" directory on your hard drive.
  • Copy both the bbox.jar and the appwiz.jar files to this directory.
  • Modify your CLASSPATH environment to point to these files: CLASSPATH=%CLASSPATH%;C:\ BeanBox\bbox.jar;
At this point it's necessary to create a link to an ODBC data source with a DSN name pointing to that source. The method used here will vary depending on the database you're working with. To keep things simple, I'll run through the sample supplied with my copy of ROAD:BeanBox. It-s a Microsoft Access file named "admin.mdb." The sample is a good way to get a feel for this product. To run the sample take the following steps:
  • Be sure that the "Microsoft Access ODBC driver" has been properly installed and configured.
  • Copy the admin.mdb file to the BeanBox directory created during installation.
  • Run "ODBC" from the control panel, adding a new Data Source sample. When prompted, specify the following attributes:
    ODBC driver = Microsoft Access Driver
    DataSource = sample
    Login name = prasad
    Password = doll1102
    (Or whatever the absolute path to the file
    is on your system)
The Application Wizard is initiated with JDK or Visual Café with the same command: java TableAppWizard.TableAppWizard.

If all goes well, this will bring up the welcome screen to the Application Wizard. Clicking "Next," you will then come to the login screen. Here you must specify the data source name you created during ODBC setup. In our example, the information entered is:
DataSource= Sample

Clicking the "Next" button establishes the connection to the database. The "Customized Info" screen will now display. Entering "Employee" as Application Name will change the directory path to c:\employee.java. For Application Format select the radio button named "Single Row - Vertical." Clicking the "Next" button takes you to the "Table-Column Information" screen. Select the table "PRASAD.DEMO_EMPLOYEE." This will automatically change the index name to the appropriate SQL number. The Columns List box will be filled with the columns in the PRASAD.DEMO_EMPLOYEE table. Click the ">>" button to select all the columns for display in the generated application. When you press the "Next" button you should get a pop-up box confirming the launch of the Visual Designer. The Visual Designer is used to preview and/or modify the layout of the screen before the code is generated. The fields can be resized by clicking and dragging to suit your needs. Pressing "OK" will generate the code generation confirmation box. Then press "OK."

Now it's time to compile the code you-ve generated. In JDK this is done with the command javac c:\Employee.java. This class file runs with java c:\Employee.

If you-re using Visual Café, import the generated code into the project. Set the main class parameter of the "Project" tab to "Employee." You will now find the "Project" tab in the "Project Options" box. Build and execute the application according to the documentation supplied with Visual Café.

As you can see, it's possible to create a single table maintenance screen in a matter of minutes. It's also possible to create "multiple row" single-table applications as well as "master detail relationship" applications using ROAD:BeanBox. Although these are a little more involved, they come much easier and quicker than with most other methods. This benefits the user because it's not necessary to take the time to learn how to write complicated programs to access and manipulate data from a server. It also allows a significant reduction in testing and configuration time. Since the amount of code is less, the amount of time testing and adjusting the code is significantly reduced. The ability to perform database tasks with less code provides other benefits as well:

  • Reduction in maintenance overhead. It's logical - less code equals less maintenance.
  • No more duplicate database connections. ROAD:BeanBox-s Connection Sharing capability centrally manages database connections to minimize the use of costly database resources.
  • Improved performance. Road:BeanBox is equipped with a backward scrolling feature for static cursors. Coupled with the batch update feature for batch cursors, this will improve response time and reduce network traffic.
  • Scalable and extensible platform. The user is provided with reusable classes, all of which have specific functions. These classes can easily be extended for the use of many business requirements.
ROAD:BeanBox is one of the neatest development tools I've seen. Although it has a full arsenal of powerful database access tools, you need only a very basic knowledge of the Java programming language to use it effectively. That alone makes it worth its weight in gold.

About the Author
Edward Zebrowski is a technical writer based in the Orlando, FL area. Ed runs his own Web development company, ZebraWeb.


All Rights Reserved
Copyright ©  2004 SYS-CON Media, Inc.
  E-mail: [email protected]

Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.