Oracle8i
Java Stored Procedures Developer's Guide Release 2 (8.1.6) Part Number A81358-01 |
|
Welcome to the future of database programming. The rapid rise of Java has forever changed the art of software development. Now, using intranets, the Internet, and Java's cross-platform ability, you can develop applications with global reach. The Oracle JServer and its Java virtual machine (JVM) provide an ideal platform on which to deploy such applications.
This guide gets you started building Java applications for Oracle8i. Working from simple examples, you quickly learn how to load, publish, and call Java stored procedures.
Anyone developing Java applications for Oracle8i will benefit from reading this guide. Written especially for programmers, it will also be of value to architects, systems analysts, project managers, and others interested in network-centric database applications. To use this guide effectively, you must have a working knowledge of Java, SQL, PL/SQL, and Oracle8i.
Note: This guide presumes you are an experienced Java programmer. If you are just learning Java, see "Suggested Reading". |
This guide is divided into the following five chapters:
After discussing Java's synergy with the Oracle RDBMS, this chapter surveys the main features of stored procedures and points out the advantages they offer. Then, you learn how the JServer JVM and its main components work with Oracle8i. The chapter ends with an overview of the Java stored procedures development process.
This chapter shows you how to load Java source, class, and resource files into the Oracle database. You learn how to manage Java schema objects using the loadjava
and dropjava
utilities. In addition, you learn about name resolution and invoker rights versus definer rights.
This chapter shows you how to publish Java classes to SQL. Among other things, you learn how to write call specifications, map datatypes, and set parameter modes.
This chapter shows you how to call Java stored procedures in various contexts. For example, you learn how to call Java from SQL DML statements, database triggers, and PL/SQL blocks.
This chapter ties together what you have learned. Step by step, it walks you through the development of a Java stored procedures application.
This guide follows these conventions:
Java code examples follow these conventions:
PL/SQL code examples follow these conventions:
Syntax definitions use a simple variant of Backus-Naur Form (BNF) that includes the following symbols:
Most programming examples in this guide use two sample database tables named dept
and emp
. Their definitions follow:
CREATE TABLE dept (deptno NUMBER(2) NOT NULL, dname VARCHAR2(14), loc VARCHAR2(13)); CREATE TABLE emp (empno NUMBER(4) NOT NULL, ename VARCHAR2(10), job VARCHAR2(9), mgr NUMBER(4), hiredate DATE, sal NUMBER(7,2), comm NUMBER(7,2), deptno NUMBER(2));
Respectively, the dept
and emp
tables contain the following rows of data:
DEPTNO DNAME LOC ------- ---------- --------- 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO ----- ------- --------- ------ --------- ------ ------ ------- 7369 SMITH CLERK 7902 17-DEC-80 800 20 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 7566 JONES MANAGER 7839 02-APR-81 2975 20 7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 7782 CLARK MANAGER 7839 09-JUN-81 2450 10 7788 SCOTT ANALYST 7566 19-APR-87 3000 20 7839 KING PRESIDENT 17-NOV-81 5000 10 7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 7876 ADAMS CLERK 7788 23-MAY-87 1100 20 7900 JAMES CLERK 7698 03-DEC-81 950 30 7902 FORD ANALYST 7566 03-DEC-81 3000 20 7934 MILLER CLERK 7782 23-JAN-82 1300 10
To create and load the tables, run the script demobld.sql
, which can be found in the SQL*Plus demo directory.
Occasionally, this guide refers you to the following Oracle publications for more information:
There are many useful online sources of information about Java. For example, you can view or download guides and tutorials from the Sun Microsystems home page on the Web:
http://www.sun.com
Another popular Java Web site is:
http://www.gamelan.com
For Java API documentation, visit:
http://www.javasoft.com/products
Also, the following Internet news groups are dedicated to Java:
comp.lang.java.programmer comp.lang.java.misc
At the following site, you can get the latest JServer news, updates, and offerings:
http://www.oracle.com/java
In addition to try-and-buy tools, you can download JDBC drivers, SQLJ reference implementations, white papers on Java application development, and collections of frequently asked questions (FAQs).
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|