Professional Documents
Culture Documents
Overview
To write applications for a server, you must
understand the way the server is architected.
Like PL/SQL, Java code that runs in the Oracle8i
JVM is running in a database session.
The Oracle Oracle8i JVM has two major modes of
operation: Java stored procedures and Presentations.
No More Tiers
The Oracle RDBMS environment includes a
Transaction Processor (TP)monitor environment,
which is quite useful. This environment is the MultiThreaded Server (MTS) architecture of Oracle8i. TP
monitors, the Holy Grail that cleansed all sin in the
1980s, are the model for todays server component
architectures. Regardless of what they say in public,
server vendors benchmark using TP monitors.
An Advanced Security
Environment
As all Java is run inside an 8i server session, there is a strong
notion of identity inherent in the environment
Login User
Embedded Java VM
The Java stored procedure execution environment is
one of an embedded Java VM. This means that the
SQL call to the database is the top-level entry point
in the session, just as it is in PL/SQL execution.
Thus, in the stored procedure world, all Java
execution happens as a result of SQL execution.
VM Startup
Top Level and Re-entrant Calls
Java State Between Calls
VM Shut Down
VM Startup
The first time Java is called, either directly as a
PL/SQL wrapped function or procedure, or
indirectly, as a trigger, the Java VM is started up.
Unlike a traditional Java VM, this is not in response
to a top-level call to the main() method. Rather
entry into the Java VM is through any public static
method that is published via a PL/SQL wrapper.
VM Shut Down
Java is shut down when the SQL session is shut down. In the
Oracle8i JVM, the method java.lang.System.exit(int) is a noop. Again, because Java is being called from a top-level SQL
call, no JSP should be terminating the session, as this causes
interesting problems with SQL clients. Naturally, there are
ways around this, the Oracle8i JVM environment providing
mechanisms by which Java can shut down the session. These
mechanisms should, of course, be used sparingly and only
when the effects are well understood by the application.
Session Establishment
Unlike SQL*NET, many Internet TCP/IP
protocols, such as HTTP do not have an intrinsic
notion of logging in. Other models, such as
CORBA, have a notion in their security model, but
implement this using the underlying protocol itself.
Because of this, a model must be created which
allows server code to run securely, establishing the
clients identity.
CPU
Object Memory
JDBC Statements
JDBC Connections
JDBC Transactions
Outbound TCP/IP Sockets
Authorization
Run As Identity
Access Control
Security Impersonation
EJB
The Java Presentation architecture was initially
developed to support EJB on the Oracle8i JVM.
The semantics of session beans are very close to the
semantics of running in the session oriented VM.
Because Java already executes in a secure server
environment, the security aspects of EJBs are easy to
map. The call oriented nature of the JVM maps
quite well to the call-oriented interface of session
beans
Servlets
In Oracle8i Release 3, the Oracle8i JVM now
contains a Servlet 2.2 compliant container
commonly known as the Oracle Servlet Engine (or
OSE). As the Oracle8i JVM is a session oriented
VM, its no surprise that the OSE is geared for
session-oriented interaction with HTTP clients.
Through the use of an Apache module, mod_ose,
stateless interaction with HTTP clients is efficient as
well.