Database Reference
In-Depth Information
Figure 4-1. Flow of a Java stored procedure
There are two things that stand out in Figure 4-1 that I want to emphasize. First is that the Java
stored procedure, function f_get_oracle_time , and the associated Java method, getOracleTime() are so
closely related that I show them in a single box. You might say they are “joined at the hip.” All that the
function f_get_oracle_time does is pass its parameters to the Java method and return the value that is
returned from the method.
The second thing I'd like to emphasize is that as the return value is passed along its return path, it is
consecutively seen as a DATE type, then a String type, then a VARCHAR2 type.
Cleaning Up
What we have just seen is merely an example of how Java stored procedures operate. You wouldn't
normally invoke a Java stored procedure just to get the time from a SELECT statement. It would be much
simpler to just invoke the built-in SYSDATE function. For example:
SELECT SYSDATE FROM DUAL;
The real usefulness of Java stored procedures is to do something hard or impossible to do in
PL/SQL.
So let's remove this example from the database with these commands:
DROP FUNCTION f_get_oracle_time;
DROP JAVA SOURCE myapp4;
The Oracle Java Virtual Machine
When Oracle corporation first included a JVM in its database, it called it Aurora. You will still find some
references to Aurora in the directories and files included with Oracle Database 11g.
The Oracle JVM in Oracle Database 11g is heavily customized, and cannot be upgraded or replaced
with a standard JVM downloaded from Sun (Oracle corporation). The Oracle JVM has a comprehensive
security structure and sandbox that is tied in with the Oracle database. That sandbox is part of what
makes the Oracle JVM impossible to replace with a standard JVM. Sandbox security settings can be
queried from the database and set with Oracle commands (we will see that in Chapter 9 when we discuss
two-factor authentication).
Oracle JVM Based on Java SE 1.5
Probably because of the amount of tailoring that Oracle corporation needed to do to build the Oracle
JVM, it is a release behind the current standard JVM. The Oracle JVM is based on Java Standard Edition
(SE) version 1.5, while 1.6 is currently supported. 1.7 was released in July 2011. Talking about versions
can really make a text like this look dated, and this paragraph may fall behind quickly; but in a few years
 
Search WWH ::




Custom Search