In early March of this year, Sun Microsystems' software company, JavaSoft, specified a standard SQL database access interface, the JDBC API. Java developers everywhere were finally given a tool to connect their applets and applications to databases, via the JDBC API. The API provided Java programmers with a uniform interface to a wide range of relational databases. Developers used the API as a common base on which to build higher level tools and interfaces. The JDBC API defined Java classes to represent database connections, SQL statements, result sets, database metadata, and allowed a programmer to issue SQL statements and process the results in their applets and applications.
XDB Systems, Inc. is now releasing JETConnect Pro, (the first in a series of Java Enterprise Tools), which features universal database access with Java by building on the ODBC foundation, taking the JDBC one step further. In this issue, Java Developer's Journal takes a look at database connectivity through the use of JETConnect Pro.
XDB's JETConnect Pro provides various levels of API's, ranging from base-level ODBC support through high-level Query by Form and Update by Form functionality using data-aware GUI components. It also provides support for features missing from the JDBC, such as scrolling cursors.
JETConnect Pro installed from a single floppy disk directly into my Java/classes directory (where I have Sun's Java Development Kit installed, which is a prerequisite). Although as of the time this article was written there are no printed manuals, a complete HTML version of the guide to the classes, methods and examples is included. The vast majority of these were created by XDB using the JDK's javadoc program, and they are very extensive.
JETConnect Pro includes three very powerful packages (a group of related classes that perform certain functions collectively) including:
JETConnect Pro also includes JETPort. JETPort is the JETConnect Pro network daemon (or NT service, depending on your server platform) that enables applets to access a database on the host Web server. JETPort supports a TCP/IP-based communication protocol that allows JETConnect Pro objects in an applet to communicate across the Internet to JETPort, which is running on a Web server. Although most of JETPort is written in Java, there is still one component that needs to be ported. For that reason, as of now, JETPort only runs on Microsoft Windows 95 and NT, Solaris and Sun OS, with ports to HP/UX and AIX platforms on the way.
- jet.connect package - This is a collection of classes that wrap Microsoft's Open Database ConnectivityTM (ODBC). The jet.connect package provides ODBC functions as methods in classes contained in this package. It also offers additional convenience methods and classes to manage various data types and other functions in a manner fully consistent with both ODBC and Java.
- JETConnect Pro JDBCTM API - This is a bridge (jet.bridge package) between JDBC applications and ODBC drivers. JDBC functionality is translated into equivalent jet.connect functionality, allowing full use of JETConnect Pro, including support for applets. (Only a single parameter in the Java code must be changed to switch between applets and applications, although applets use a special set of classes to enable remote access of a database from a Web client.)
- jet.controls package - This is a collection of components that simplify database application and applet development by providing:
- - A higher level database API with functionality equivalent to that of embedded SQL.
- - Classes supplying data-aware GUI components that link to columns in your database and a powerful set of methods that can perform Queries by Form and Updates by Form.
- - Advanced GUI components, required for sophisticated database applications.
Using JETConnect Pro, you are able to provide full transaction processing support to your Java applications and applets. The complete functionality of the data source being accessed is available to your Java program using JETConnect, unlike the JDBC, which is at best a least-common-denominator subset of the full ODBC API. You are able to update, insert, delete and edit records (see Figure 1) in the database with which you are working. JETConnect Pro has provided a complete implementation of the functionality that ODBC provides by using an object-oriented paradigm. By wrapping each of the ODBC handles (environment, connection and statement) with a Java class, all of the ODBC functions can be implemented in a Java applet or application as methods of these Java classes.
In this code sample (which is provided with JETConnect Pro) (see Listing 1) controls for inserting, updating, deleting, editing and moving from record to record are implemented using the JETControls package. JETConnect Pro's unique data-aware class library, which is based on the Java AWT (Abstract Window Toolkit), allows you to link GUI components and composite controls, such as text fields, text boxes or data-aware grid controls, to a field or fields in a database table (see Figure 2). Using Query by Forms and Update by Forms, JETConnect Pro can operate on any field connected to the database, and supports most of the common search criteria entered by the client, including:
- exact match
- null test
- pattern matching
- range checking
- list of values
Based on the changes that a user makes to the fields in an applet or application window, JETConnect Pro uses the Update by Forms feature to dynamically build and execute SQL update, delete and insert statements. The full power and functionality of JETConnect Pro is demonstrated by its ability to execute all SQL statements within the context of a single transaction.
Java is a full featured language that is extendible, flexible, and less error prone than most object-oriented languages. It is platform independent, allowing developers the ability to develop applications that will work equally well on PCs, Macs, and Unix machines. Unfortunately, Java does not have the inherent ability to access databases directly. Using XDB's JETConnect Pro, developers have the choice of using the JETConnect ODBC API or the JDBC API. With JETConnect Pro, programmers no longer have to be dependent on vendor-specific restrictions to feature high performance database access in their applets and applications. As the Java language continues to develop, these features are not likely to be an accessory, but more of a requirement.