By Mike Ault
JAVA is an interpreted, platform independent
language, was only recently introduced to the computing world. In a
few short years it has risen from total obscurity (indeed,
non-existence) to a pre-eminent position in the hierarchy of
programming languages. This book is not intended as a primer for
JAVA, we will examine a few examples using JDBC (JAVA Database
Connectivity) and JSQL (An Alpha release of the Oracle PRO*JAVA
product offering) against an Oracle8 database. JDK1.1.4, JDBC and
JSQL are all available via the Internet.
JAVA owes its platform independence to the fact
that it is interpreted and not compiled. Essentially the machine
level code for a JAVA script (JAVA Bytecode) is not generated until
runtime so the script is downloaded from the web to the local
machine. This means that as long as a JAVA interpreter has been
written for an operating system your users are on, the JAVA applet
that you write on your PC will run on it. This is synonymous to the
language BASIC in the early days of programming.
One has to wonder
that if machines would have been as fast back in the early days of
BASIC, making interpreted languages possible for use in production
level systems, would other languages such as FORTRAN, COBOL and even
C been pursued as readily?
JAVA was initially built to be a toolkit language
for small device programming (i.e. that JAVA enabled cappuccino
machine). This meant that it had to be highly portable, hence it's
emergance as a language of choice for web applications. Now,
extensions such as JDBC ( JAVA Database Connectivity - a take off on
ODBC - Open Database Connectivity) and now JSQL (JAVA SQL) places
JAVA firmly as a prime candidate for use in company intranet
databases and for WEB databases as the language to use for your
interface between HTML pages and the database servers.
Of course, JAVA with the various extensions such as
JDBC and JSQL, can also be used as a stand alone language with or
development of the entire JAVA paradigm.
Due to security features of JAVA, if it is used to
access databases on other servers, it is not allowed to rely on such
objects as external shared libraries such as DLLs. Therefore there
are two modes for use of the JDBC component, the first relies on
external ODBC/JDBC communication libraries. The second, known as a
"thin" connection, uses internalized drivers allowing it to access
Due to JAVA being in its youth, it is still
undergoing many changes and improvements. This can sometimes lead to
difficulties as classes are depreciated (this means made obsolete,
dropped or changed) the
WWW.JAVASOFT.COM web page will provide the latest copy of
the JDK (JAVA Developers Kit), at least until the language is
The version provided on the enclosed CD-ROM is JDK1.1.4, additionally, the JDK1.0 version is also provided in case
your system browsers can't support the newer version. I suggest
obtaining the latest copies of the various browsers and be sure that
they are JAVA compliant or the examples in this book may not
function without modification (beyond username, password and
The JDBC and JSQL extensions are available from
the WWW.ORACLE.COM webpage and if you read this after mid-1998 I
suggest downloading the latest copies from there.
JAVA is case sensitive. This case sensitivity means
if a method is named DBATempSelect that is how it must be referred
to from now on. This seems to be a carry over from JAVAs SUN-UNIX
beginnings. I know I would never have multiple objects with only a
capital letter or so difference between their names, how about you?
If a method, class or variable name is shown a specific way then it
must be used that way, remember this fact when dealing with the JAVA
I utilized over $300.00 worth of
after market books. You see, JAVA is young enough that there is no
one reference that provides insight into use of JAVA with databases,
use of JAVA with images and use of JAVA, JDBC and JSQL, each book
seems to have pieces of the puzzle, but not the complete picture.
In spite of all of these references I still had to
email a couple of other Coriolis authors with a question about a
problem that the JAVA virtual machine beat me up over for a couple
of days. It is critical that you use the most current version of the
JDK (JAVA Developers Kit) and the class libraries and that your
references are as current as possible. One problem that you will
encounter if you use outdated libraries is called "deprecation".
Deprecation is the process by which old versions of
JAVA classes are marked so that the JAVA compiler warns you that
they are no longer actively supported. While many books tell you
about this, they don't tell you how to fix the problem when it
In JAVA There are already several major classes
with many subclasses beneath them. Some examples of the major
classes are : awt, io, lang, applet, net and utl. Some examples
(from the awt superclass) of subclasses are: peer, image, graphics,
component just to name a few.
The section of the LeMay book on the
awt package of classes takes 165 pages to cover just the basics of
the package definition. Of course each class and subclass may have
many methods (usually 8-10) including constructor methods and, since
JAVA supports inheritance any subclass inherits behaviors from the
superclass it is a part of. All of this inheritance can lead to
great confusion when you are trying to find out exactly how to make
an instance of class X perform operation Y.