Sun Java Solaris Communities My SDN Account Join SDN
 
Article

JDBC and CORBA Basics: Excerpts from a Java 2 reviewer's guide

 


At the 1998 Java Business Expo in New York, reporters covering the conference received a document titled the Java Development Kit (JDK) 1.2 Reviewer's Guide. This article contains two parts of that guide: the parts that introduce JDBC and CORBA (Common Object Request Brokerage Architecture).

Edited by Dale Green

Database Access with JDBC

The JDBC Database API (JDBC) is a Java API for executing SQL statements. JDBC makes it easy to send SQL statements to virtually any relational database. And since Java technology is platform independent, JDBC is the ideal API for writing database applications in a heterogeneous environment.

The JDBC API supports both two-tier and three-tier models for database access. In the two-tier model, a Java application talks directly to the database using a JDBC driver. In the three-tier model, commands are sent to an application server, which then sends SQL statements to the database. The Java application on the client can communicate with the Java application on the server by various protocols: HTTP, RMI, CORBA, and so forth. The database processes the SQL statements and sends the results back to the middle tier, which then sends them to the client. The three-tier model offers several benefits: greater control over access to corporate data, the ability of the client to use a simpler, higher-level API, and in many cases , increased performance. The following illustration shows how Java technology might be used in a three-tier system.

JDBC Enhancements

The initial release of the JDBC API was well received by both application developers and database vendors. The latest release, JDBC 2.0, contains new features requested by the JDBC community, which includes over twenty partner companies. These new features make it even easier to build sophisticated database applications in the Java programming language.

Scrollable Result Sets

A result set contains the rows returned by a query. JDBC 2.0 supports scrollable result sets, which allow an application to move both forwards and backwards through a result set. Scrollable result sets allow developers to create GUI tools for browsing rows of data. Scrollable result sets also support relative and absolute positioning, allowing the program to move quickly to a row that requires updating.

Batch Updates

Batch updates allow an application to submit multiple update statements (insert, update, delete) in a single request to the database. This can increase performance dramatically when a large number of update statements must be executed.

SQL3 Datatypes

The datatypes commonly referred to as SQL3 types are the new datatypes being adopted in the next version of the ANSI/ISO SQL standard. The JDBC 2.0 API provides interfaces that represent the mapping of these SQL3 datatypes into the Java programming language.

The new SQL3 datatypes give a relational database more flexibility in what can be used as a type for a table column. For example, a column may now contain BLOB (Binary Large Object) values, which can store huge amounts of raw byte data, such as image or sound files. A column may also be of type CLOB (Character Large Object), which is capable of storing very large amounts of character data. The new type ARRAY makes it possible to use an array as a column value. Even the new SQL user-defined types (UDTs), structured types, and distinct types, can now be stored as column values.

CORBA Support with Java IDL

Java IDL is a technology for distributed objects--that is, objects interacting on different platforms across a network. Java IDL is based on the Common Object Request Brokerage Architecture (CORBA), an industry-standard distributed object model. A key feature of CORBA is IDL, a language-neutral Interface Definition Language. Each language that supports CORBA has its own IDL mapping. Java IDL supports the mapping for the Java programming language.

The following illustration shows a three-tier client/server application constructed with Java IDL. Applications using Java IDL can interoperate with other objects on the Object Request Broker (ORB) bus.

Java IDL Features

These are some of the features of Java IDL:

  • Based on open industry standards: CORBA and the IDL mappings are the work of an industry consortium known as the OMG, or Object Management Group. Sun Microsystems is a founding member of the OMG, and the IDL team at Java Software has played an active role in defining the IDL-to-Java mapping.
  • Enables interoperability in heterogeneous information systems: Java IDL allows Java applications to access distributed components on the CORBA object bus. CORBA components can exist on various types of computers across a network.
  • Allows Java applications to interact with programs written in other languages: Java IDL enables objects to interact regardless of whether they're written in the Java programming language or other languages such as C, C++, or COBOL.
  • Enables Coexistence with Legacy Systems: Developers can encapsulate existing applications with IDL wrappers. Once on the CORBA object bus, the existing applications become distributed objects. With Java IDL, new Java applications can interact with existing applications on the CORBA object bus.
  • Works with the idltojava compiler and runtime components: The idltojava compiler, which is now available for download, generates portable client stubs and server skeletons that work with any CORBA- compliant Object Request Broker (ORB) implementation. The JDK 1.2 software includes the CORBA API and a CORBA-compliant ORB that allows Java applications to invoke remote CORBA objects through the industry standard Internet Inter-ORB Protocol (IIOP).

For More Information

To find out more about the topics covered in this guide, follow these links: