Download Java glabājamās procedūras

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Clusterpoint wikipedia , lookup

Oracle Database wikipedia , lookup

SQL wikipedia , lookup

Database model wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Open Database Connectivity wikipedia , lookup

PL/SQL wikipedia , lookup

Object-relational impedance mismatch wikipedia , lookup

Versant Object Database wikipedia , lookup

Transcript
Informācijas sistēmas
arhitektūra
Biezais
(thick, fat)
klients
Lietojumu
serveris
Objekturelāciju
attēlojums
(ORM)
Lietojumu servera
uzdevumi:
1) lieli lietojumi;
2) web serveris;
3) transakciju
serveris.
Datu bāzes sistēma
Datu bāzes interfeiss
Plānais
(thin)
klients
Datu bāzes
interfeisi:
1) ODBC;
2) OLE DB;
3) ADO;
4) JDBC.
Datu
bāzes
serveris
(DBVS)
Datu bāze
Dati un meta-dati
Servera
procedūras
(progr. valodas
PL/SQL, Java un
citas)
Universālā datu bāze:
1) relāciju datu bāze;
2) objektu datu bāze;
3) relāciju-objektu datu
bāze;
4) XML datu bāze.
2
Lietojumu programmas, glabājamās procedūras un
trigeri
Datu bāzes sistēma
Datu bāze
Lietojumu
programma
DBVS
Glabājamā
procedūra (stored
procedure)
programma
Dati un
metadati
Trigeris
1. Use client-side programming to embed SQL statements in applications written in
procedural languages such as C, C++, or Java.
1) You can place SQL statements in source code and submit it to a precompiler or
Java translator before compilation.
2) You can eliminate the precompilation step and use:
- an API such as Java Database Connectivity (JDBC);
- Oracle Call Interface (OCI) to enable the application to interact with the database.
2. Use server-side programming to develop data logic that resides in the database. An
application can explicitly invoke stored subprograms (procedures and functions),
written in PL/SQL or Java.
You can also create a trigger, which is named program unit that is stored in the
database and invoked in response to a specified event.
3
Programmu pakešu lietošana datu bāzē
4
Trigeri
5
Kāpēc programmēšana datu bāzes serverī?
1. All programs reside in one machine called the Server. Any number of remote
machines (called clients) can access the server programs.
2. New functionalities to existing programs can be added at the server side not client.
3. Migrating to newer versions, architectures, design patterns, adding patches,
switching to new databases can be done at the server side without having to bother
about clients? hardware or software capabilities.
4. Issues relating to enterprise applications like resource management,
concurrency, session management, security and performance are managed by
service side applications.
6
Klienta – servera sistēma izmantojot Oracle DBVS
7
Java glabājamās procedūras
Java programmu izmantošanas datu bāzes serverī
Datu bāzes sistēma
K
1
Tabula
K K K
2
3
4
PL/SQL programmas čaula
DB glabājamā procedūra
Java programmēšanas
valodā
8
DB glabājamās procedūras (stored procedures)
Oracle javas virtuālā mašīna OracleJVM nodrošina sekojošu programmu
izpildi:
1) funkciju un procedūru;
2) trigeru;
3) relāciju-objektu metožu.
9
Java Memory Areas
In OracleJVM, the states of Java objects are preserved in special data structures
called “object memories.” There are several object memory types:
1) newspace is the default memory for allocating almost all Java objects, except
large objects, which are allocated in Oldspace.
2) oldspace is an object memory used for holding long-lived or large objects (i.e.,
larger than 1-K Bytes) for the duration of a call.
3) runspace is an object memory residing in CGA or PGA and is used to hold
system objects (e.g., classloader objects) allocated for the duration of a call.
4) stackspace is an object memory residing in CGA or PGA and is used to
allocate system objects and objects used by the Java interpreter (no user
objects);
5) sessionspace, also called “session memory,” is an object memory residing in
the User Global Area (UGA), which is associated with each session (each
session has its own Sessionspace) and lives as long as the session lives.
Sessionspace is used to preserve state of system objects, user objects, and
metadata used by the Java runtime.
10
Java atmiņas apgabali izdalītā servera gadījumā
11
Java atmiņas apgabali koplietojuma servera gadījumā
12
A Java application may result in:
1) of bytecodes (interpreted);
2) natively compiled binaries.
Therefore, the natively compiled code must be fully interoperable with the Java
VM. The native compiler has been designed to generate C code that allows
natively compiled routines to call (and be called from) interpreted Java
bytecode.