Internet Features   «Prev  Next»

Lesson 3Java and Oracle
ObjectiveDescribe how Java has been integrated into Oracle.

Java and Oracle

The Java Virtual Machine (JVM) runs Java applications. If you create a Java application on your desktop, it will run without any modification on your mainframe because both your desktop and your mainframe have JVM. That's the advantage of using Java for your application programming. And Java is quickly becoming one of the most popular programming platforms around. Oracle has JVM built into the database server itself. This means that you can run Java applications inside your database. You can also deliver an applet to a Web page using the built-in features of your Oracle database and no Web server is needed. Look at the Slide Show below to see more excellent advantages of using the Oracle JVM.

  1. Combine PL-SQL and Java, or substitute Java for PL-SQL within stored procedures, functions, triggers, object methods
  2. Connect the database with the native JDBC. When you create JDBC calls to query tables or perform DML commands
  3. Take advantage of Oracle's scalability to service more concurrent users with less resources than ordinary JVMs.

Java Virtual Machine

Components of the JVM:

  1. stack (per thread)
  2. heap
  3. constant pool
  4. code segment
  5. program counter (per thread)
With the ubiquity of Java on the Web, you may be tempted to create a fully Java-based database application. In that architecture, the client communicates with the application server via either HTTP or the Internet Inter-ORB Protocol (IIOP). Within the database, you can create Java classes, and the application server would interact with those Java classes via IIOP. Thus, you can create a Web-enabled database that does not rely on Oracle Network Services for any of its connectivity. Within the database, you can write your stored procedures in either PL/SQL. In general, you should use these languages for the functions they perform best:
  1. PL/SQL for database interaction and
  2. Java for non-database-related functions.
If you use Java exclusively throughout your application, you should expect to encounter performance or functionality limitations during its production usage. Java is well suited for use on the client and application server. In your application development process, you should test the implications of using Java in place of PL/SQL or SQL for your database access. PL/SQL has been part of the Oracle kernel for over a decade and is well suited for quick data retrieval and manipulation.
You will find a good tutorial on creating Web applets that query database tables in the Oracle demo directory under the SQL Developer installation. Java Applets are primarily used as client software components that are installed remotely in order to produce trouble shooting.
The next lesson describes interMedia, an Oracle add-on tool.