Hands On - Visual Programming - Patch works
By Tim Anderson:
CodeBase: Solution for Java Programmers
CodeBase is a solution for those who would rather avoid
database technologies like the Borland Database Engine or Microsoft JET. Although
these systems are rich in features and, in theory, easy to work with, they introduce extra
layers of software, upping runtime requirements and making it difficult to troubleshoot
problems. CodeBase does not use any of them. Instead, it provides its own library of
database functions, for C, C++, Delphi, Visual Basic and now Java.
Unfortunately, the price of this simplicity is that the
built-in database features of these environments do not work with CodeBase: bound controls
in Delphi are not supported except via the special CodeBase-supplied components, for
example. The benefit is fast data access and easy runtime deployment.
I was particularly interested in the Java version.
CodeBase now comes on one CD which supports all the above-mentioned environments. Java
support comes in the form of around 30 small classes (occupying about 50Kb) which let you connect to the CodeBase server. Data
access is achieved by constructing a Code4 object which represents the connection, then
Data4 objects which represent tables, and Field4 objects and their descendants which
represent fields. Fig 1 (above) illustrates a minimal example of searching an address
table.
Using CodeBase, it was not difficult to create a simple
applet for looking up phone numbers, and to run it successfully in Netscape and Internet
Explorer on both Windows and the Mac.
There are some problems, though. One is that only a
subset of the CodeBase functions available in other languages are supported in Java. In
particular, the query and relation functions are missing, so database searches are more or
less limited to seek(). Another is that the product is rough and ready in places and you
need to be prepared to experiment.
The Java classes are in a package called CodeBase, which
should be renamed com.sequiter.codebase to follow Sun's guidelines for avoiding the risk
of duplicate package names. Source is supplied, though, so you can go ahead and make the
change. Most people will want to stay with the mainstream Java standards, using JDBC and
SQL databases [Ed. Support for these are currently available], but CodeBase is worth considering, especially if you need to integrate with
an existing xBase system or want a lightweight solution on client and server.
|