Oracle8i Java Developer's Guide
Release 3 (8.1.7)

Part Number A83728-01


Solution Area



Go to previous page Go to beginning of chapter Go to next page

Oracle's Java Application Strategy

One appeal of Java is its ubiquity and the growing number of programmers capable of developing applications using it. Oracle furnishes enterprise application developers with an end-to-end Java solution for creating, deploying, and managing Java applications. The total solution consists of client- and server-side programmatic interfaces, tools to support Java development, and a Java virtual machine integrated with the Oracle8i database server. All of these products are 100 percent compatible with Java standards.

In addition to the Aurora JVM, the Oracle8i's Java programming environment consists of:

To enable your decision making for which Java APIs to use, examine the following table:

Type of functionality you need   Java API to use  

To have a Java procedure invoked from SQL, such as a trigger.  

Java Stored Procedures  

To invoke a static, simple SQL statement from a known table with known column names from a Java object.  


To invoke dynamic, complex SQL statements from a Java object.  


To invoke Java from an HTML page  

Servlets or JavaServer Pages  

To create a multi-tier Java application.  


Java Stored Procedures

If you are a PL/SQL programmer exploring Java, you will be interested in Java stored procedures. A Java stored procedure is a program you write in Java to execute in the server, exactly as a PL/SQL stored procedure. You invoke it directly with products like SQL*Plus or indirectly with a trigger and can access it from any Net8 client--OCI, PRO*, JDBC or SQLJ. The Oracle8i Java Stored Procedures Developer's Guide. explains how to write stored procedures in Java, how to access them from PL/SQL, and how to access PL/SQL functionality from Java.

In addition, you can use Java to develop powerful programs independently of PL/SQL. Oracle8i provides a fully compliant implementation of the Java programming language and JVM.

PL/SQL Integration and Oracle RDBMS Functionality

You can invoke existing PL/SQL programs from Java and invoke Java programs from PL/SQL. This solution protects and leverages your existing investment while opening up the advantages and opportunities of Java-based Internet computing.

Oracle offers two different application programming interfaces (APIs) for Java developers to access SQL data--JDBC and SQLJ. Both APIs are available on client and server, so you can deploy the same code in either place.

JDBC Drivers

JDBC is a database access protocol that enables you to connect to a database and then prepare and execute SQL statements against the database. Core Java class libraries provide only one JDBC API. JDBC is designed, however, to allow vendors to supply drivers that offer the necessary specialization for a particular database. Oracle delivers JServer with the following three distinct JDBC drivers.

Driver   Description  

JDBC Thin Driver  

You can use the JDBC thin driver to write 100% pure Java applications and applets that access Oracle SQL data. The JDBC thin driver is especially well-suited to Web browser-based applications and applets because you can dynamically download it from a Web page just like any other Java applet.  

JDBC Oracle Call Interface Driver  

The JDBC Oracle Call Interface (OCI) driver accesses Oracle-specific native code (that is, non-Java) libraries on the client or middle tier, providing a richer set of functionality and some performance boost compared to the JDBC thin driver, at the cost of significantly larger size and client-side installation.  

JDBC Server-side Internal Driver  

Oracle8i uses the JServer server-side internal driver when Java code executes on the server. It allows Java applications executing in the server's Java virtual machine to access locally defined data (that is, on the same machine and in the same process) with JDBC. It provides a further performance boost because of its ability to use underlying Oracle RDBMS libraries directly, without the overhead of an intervening network connection between your Java code and SQL data. By supporting the same Java-SQL interface on the server, Oracle 8i does not require you to rework code when deploying it.  

For more information on JDBC, see "Utilizing SQLJ and JDBC for Querying Database" or a complete detailed description within the Oracle8i JDBC Developer's Guide and Reference.

SQLJ - Embedded SQL in Java

JDBC provides a low-level API for accessing SQL data from Java. It introduces Java classes that mirror their SQL equivalents. Oracle has worked with other vendors, including IBM, Tandem, Sybase, and Sun Microsystems, to develop a standard way to embed SQL statements in Java programs--SQLJ. This work has resulted in a new standard (ANSI x.3.135.10-1998) for a simpler and more highly productive programming API than JDBC. A user writes applications to this higher-level API and then employs a preprocessor to translate the program to standard Java source with JDBC calls. At runtime, the program can communicate with multi-vendor databases using standard JDBC drivers. SQLJ provides a simple, but powerful, way to develop both client-side and middle-tier applications that access databases from Java. You can use it in stored procedures, triggers, methods within the JServer environment, and with EJB and CORBA. In addition, you can combine SQLJ programs with JDBC.

The SQLJ translator is a Java program that translates embedded SQL in Java source code to pure JDBC-based Java code. Because JServer provides a complete Java environment, you can not only compile SQLJ programs on a client for execution on the JServer, but you can compile them directly on the server. Oracle8i's adherence to Internet standards allows you to choose the development style that fits your needs.

For more information on SQLJ, see "Utilizing SQLJ and JDBC for Querying Database" or for a complete detailed description, see the SQLJ Developer's Guide and Reference.

Dynamic HTML Invoking Java

You can invoke Java from within dynamic HTML protocols, such as servlets or JavaServer Pages.


A servlet is useful for managing requests between HTML and Java applications, specifically within a web server context. Servlets are to servers what applets are to browsers. Servlets, as a true Java and HTML based protocol is platform independent, and thus can be used in multiple environments.

See the Oracle8i Oracle Servlet Engine User's Guide for more information.


JavaServer Pages is a a method of generating dynamic content in pages that are output by a Web application, such as an application running on a Web server. This allows you to include Java code snippets and calls to external Java components within the HTML code (or other markup code, such as XML) of your Web pages. JavaServer Pages works nicely as a front-end for business logic and dynamic functionality in JavaBeans and Enterprise JavaBeans (EJBs). In addition, anything that you can include in a normal HTML page can be included in a JSP page as well.

For example, a JSP page can call a component such as a JavaBean or Enterprise JavaBean, and the bean will directly or indirectly access the database, generally through JDBC or perhaps SQLJ.

A JSP page is translated into a Java servlet before being executed. It processes HTTP requests and generates responses similarly to any other servlet. JSP pages are fully interoperable with servlets--JSP pages can include output from a servlet or forward to a servlet, and servlets can include output from a JSP page or forward to a JSP page.

See the Oracle JavaServer Pages Developer's Guide and Reference for more information.

Distributed Application Development

In addition to support for traditional RDBMS-stored procedures, JServer comes with a built-in CORBA 2.0 ORB and support for Enterprise JavaBeans (EJB). CORBA and EJB allow you to distribute Java components and application logic between client, middle-tier, and database server.


The ORB allows programs you develop in any language to communicate directly with the Oracle8i database through Internet Inter-ORB Protocol (IIOP), the standard wire-protocol defined by the Object Management Group (OMG).  

Enterprise JavaBeans (EJB)  

For 100% pure Java applications, EJB is the standard framework for deploying component-based, secure, transactional applications on JServer.  

Using EJB Components

"Java and Object-Oriented Programming Terminology" discusses encapsulation as a key element of object-oriented programming. Each object maintains its own private state and supports a set of behaviors, which you implement as methods. Java provides a formal way to define components, using JavaBeans. A JavaBean component is a reusable object or group of objects (more precisely, an object graph) that you can manipulate in a builder tool of some type. IDEs, such as JDeveloper, provide tools to build user interfaces that use JavaBeans and create JavaBean components. Each bean specifies its public interface and properties that can be manipulated. JavaBeans do not have to be visually-oriented components. Virtually any Java programming abstraction can potentially be represented and manipulated as a bean.

A large component library provides the basis for assembling an application from pre-built, pre-tested building blocks. However, beans are limited in their ability to build complex business applications involving transactional logic. To address this limitation, a group of companies, including Oracle, Sun Microsystems, and IBM, developed the Enterprise JavaBean (EJB) specification. EJB introduces a declarative mechanism for specifying how components deal with transactions and security. Refer to the Oracle8i Enterprise JavaBeans Developer's Guide and Reference or the Oracle8i CORBA Developer's Guide and Reference books for detailed information about using EJB components in Oracle8i.

There are alternative component models to JavaBeans and Enterprise JavaBeans-- notably, Microsoft's COM and COM+ models. If you have existing Microsoft COM-oriented applications, they can interact with open Internet standards, such as JavaBeans and EJB, with bridge products available from different vendors.

Development Tools

The introduction of Java to the Oracle8i server allows you to use several Java Integrated Development Environments. JServer's adherence to Java compatibility and open Internet standards and protocols ensures that your 100% pure Java programs work when you deploy them on JServer. Oracle delivers JServer with many tools or utilities, all written in Java, that make development and deployment of Java server applications easier. Oracle's JDeveloper has many features designed specifically to make deployment of Java stored procedures and Enterprise JavaBeans easier.

Go to previous page
Go to beginning of chapter
Go to next page
Copyright © 1996-2000, Oracle Corporation.

All Rights Reserved.


Solution Area