Download Chapter 29 - ShareStudies.com

Document related concepts

Database model wikipedia , lookup

Clusterpoint wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Object-relational impedance mismatch wikipedia , lookup

Transcript
Chapter 29
Web Technology and DBMSs
Transparencies
© Pearson Education Limited 1995, 2005
1
Chapter 29 - Objectives
 Basics
of Internet, Web, HTTP, HTML, URLs.
 Advantages and disadvantages of Web as a
database platform.
 Approaches for integrating databases into Web:
– Scripting Languages
– Common Gateway Interface (CGI)
– HTTP Cookies
2
© Pearson Education Limited 1995, 2005
Chapter 29 - Objectives
– Extending the Web Server
– Java, J2EE, JDBC, SQLJ, CMP, JDO, Servlets,
and JSP
– Microsoft Web Platform: .NET, ASP, and ADO
– Oracle Internet Platform.
3
© Pearson Education Limited 1995, 2005
Introduction
 Web
most popular and powerful networked
information system to date.
 As architecture of Web was designed to be
platform-independent, can significantly lower
deployment and training costs.
 Organizations using Web as strategic platform for
innovative business solutions, in effect becoming
Web-centric.
4
© Pearson Education Limited 1995, 2005
Introduction
 Many
Web sites today are file-based where each
Web document is stored in separate file.
 For large sites, this can lead to significant
management problems.
 Also many Web sites now contain more dynamic
information, such as product and pricing data.
 Maintaining such data in both a database and in
separate HTML files is problematic.
 Accessing database directly from Web would be
a better approach.
5
© Pearson Education Limited 1995, 2005
Internet
Worldwide collection of interconnected networks.
Began in late ‘60s in ARPANET, a US DOD
project, investigating how to build networks that
could withstand partial outages.
 Starting with a few nodes, Internet estimated to
have over 945 million users by end of 2004.
 2 billion users projected by 2010.
 About 3.5 billion documents on Internet (550
billion if intranets/extranets included).

6
© Pearson Education Limited 1995, 2005
Intranet and Extranet
 Intranet
- Web site or group of sites belonging to
an organization, accessible only by members of
that organization.
 Extranet
- An intranet that is partially accessible
to authorized outsiders.
 Whereas
intranet resides behind firewall and is
accessible only to people who are members of same
organization, extranet provides various levels of
accessibility to outsiders.
7
© Pearson Education Limited 1995, 2005
eCommerce and eBusiness
 eCommerce
- Customers can place and pay for
orders via the business’s Web site.
 eBusiness
- Complete integration of Internet
technology into economic infrastructure of the
business.
 Business-to-business
transactions may reach $2.1
trillion in Europe and $7 trillion in US by 2006.
 eCommerce
may account for $12.8 trillion in
worldwide corporate revenue by 2006 and could
represent 18% of sales in the global economy.
8
© Pearson Education Limited 1995, 2005
The Web
Hypermedia-based system that provides a simple
‘point and click’ means of browsing information
on the Internet using hyperlinks.
 Information
presented on Web pages, which can
contain text, graphics, pictures, sound, and video.
 Can also contain hyperlinks to other Web pages,
which allow users to navigate in a non-sequential
way through information.
 Web documents written using HTML.
9
© Pearson Education Limited 1995, 2005
The Web
 Web
consists of network of computers that can
act in two roles:
– as servers, providing information;
– as clients (browsers), requesting information.
 Protocol that governs exchange of information
between Web server and browser is HTTP and
locations within documents identified as a URL.
 Much of Web’s success is due to its simplicity and
platform-independence.
10
© Pearson Education Limited 1995, 2005
Basic Components of Web Environment
11
© Pearson Education Limited 1995, 2005
HyperText Transfer Protocol (HTTP)
Protocol used to transfer Web pages through
Internet.
 Based
on request-response paradigm:
Connection - Client establishes connection with Web server.
Request Client sends request to Web server.
Response - Web server sends response (HTML document)
to client.
Close Connection closed by Web server.
12
© Pearson Education Limited 1995, 2005
HyperText Transfer Protocol (HTTP)
HTTP/1.0 is stateless protocol - each connection is
closed once server provides response.
 This makes it difficult to support concept of a
session that is essential to basic DBMS
transactions.

13
© Pearson Education Limited 1995, 2005
HyperText Markup Language (HTML)
Document formatting language used to design most
Web pages.
A
simple, yet powerful, platform-independent
document language.
 HTML is application of Standardized Generalized
Markup Language (SGML), a system for defining
structured document types and markup languages
to represent instances of those document types.
14
© Pearson Education Limited 1995, 2005
HyperText Markup Language (HTML)
15
© Pearson Education Limited 1995, 2005
Uniform Resource Locators (URLs)
String of alphanumeric characters that represents
location or address of a resource on Internet and
how that resource should be accessed.
Defines uniquely where documents (resources) can
be found.
 Uniform Resource Identifiers (URIs) - generic set
of all Internet resource names/addresses.
 Uniform Resource Names (URNs) - persistent,
location-independent name. Relies on name
lookup services.

16
© Pearson Education Limited 1995, 2005
Uniform Resource Locators (URLs)
 URL consists
of three basic parts:
– protocol used for the connection,
– host name,
– path name on host where resource stored.
 Can
optionally specify:
– port through which connection to host should be made,
– query string.
http://www.w3.org/Markup/MarkUp.html
17
© Pearson Education Limited 1995, 2005
Static and Dynamic Web Pages
HTML document stored in file is static Web
page.
 Content of dynamic Web page is generated each
time it is accessed.
 Thus, dynamic Web page can:

– respond to user input from browser;
– be customized by and for each user.
Requires hypertext to be generated by servers.
 Need scripts that perform conversions from
different data formats into HTML ‘on-the-fly’.

18
© Pearson Education Limited 1995, 2005
Web Services
Collection of functions packaged as single entity and
published to network for use by other programs.
 Web services are important paradigm in building
applications and business processes for the
integration of heterogeneous applications.
 Based
on open standards and focus on
communication and collaboration among people
and applications.
 Unlike other Web-based applications, Web services
have no user interface and are not targeted for
browsers. Instead, consist of reusable software
components designed to be consumed by other
applications.
19
© Pearson Education Limited 1995, 2005
Web Services – Technologies & Standards
eXtensible Markup Language (XML).
 SOAP (Simple Object Access Protocol) protocol, based
on XML, used for communication over Internet.
 WSDL (Web Services Description Language) protocol,
again based on XML, used to describe the Web service.
 UDDI (Universal Discovery, Description and
Integration) protocol used to register the Web service
for prospective users.

20
© Pearson Education Limited 1995, 2005
Web Services
 Common
example is stock quote facility, which
receives a request for current price of a specified
stock and responds with requested price.
 Second example is Microsoft MapPoint Web
service that allows high quality maps, driving
directions, and other location information to be
integrated into a user application, business
process, or Web site.
21
© Pearson Education Limited 1995, 2005
Requirements for Web-DBMS Integration
 Ability
to access valuable corporate data in a
secure manner.
 Data- and vendor-independent connectivity to
allow freedom of choice in DBMS selection.
 Ability to interface to database independent of
any proprietary browser or Web server.
 Connectivity solution that takes advantage of all
the features of an organization’s DBMS.
22
© Pearson Education Limited 1995, 2005
Requirements for Web-DBMS Integration
 Open
architecture to allow interoperability with a
variety of systems and technologies. For example:
– different Web servers;
– Microsoft's (Distributed) Common Object Model
(DCOM/COM);
– CORBA/IIOP (Internet Inter-ORB protocol);
– Java/Remote Method Invocation (RMI);
– XML;
– Web services (SOAP, WSDL, UDDI).
 Cost-effective
solution that allows for scalability,
growth, and changes in strategic directions, and
helps reduce applications development costs.
© Pearson Education Limited 1995, 2005
23
Requirements for Web-DBMS Integration
 Support
for transactions that span multiple HTTP
requests.
 Support for session- and application-based
authentication.
 Acceptable performance.
 Minimal administration overhead.
 Set of high-level productivity tools to allow
applications to be developed, maintained, and
deployed with relative ease and speed.
24
© Pearson Education Limited 1995, 2005
Advantages of Web-DBMS Approach
 DBMS
advantages
 Simplicity
 Platform independence
 Graphical User Interface
 Standardization
 Cross-platform support
 Transparent network access
 Scalable deployment
 Innovation
25
© Pearson Education Limited 1995, 2005
Disadvantages of Web-DBMS Approach
 Reliability
 Security
 Cost
 Scalability
 Limited
functionality of HTML
 Statelessness
 Bandwidth
 Performance
 Immaturity of development tools
26
© Pearson Education Limited 1995, 2005
Approaches to Integrating Web and DBMSs
Scripting Languages.
 Common Gateway Interface (CGI).
 HTTP Cookies.
 Extending the Web Server.
 Java, J2EE, JDBC, SQLJ, JDO, Servlets, and JSP.
 Microsoft Web Solution Platform: .NET, ASP, and
ADO.
 Oracle Internet Platform.

27
© Pearson Education Limited 1995, 2005
Scripting Languages (JavaScript and VBScript)
 Scripting
languages can be used to extend
browser and Web server with database
functionality.
 As script code is embedded in HTML, it is
downloaded every time page is accessed.
 Updating browser is simply a matter of
changing Web document on server.
 Some
popular scripting languages are:
JavaScript, VBScript, Perl, and PHP.
 They are interpreted languages, not compiled,
making it easy to create small applications.
28
© Pearson Education Limited 1995, 2005
Common Gateway Interface (CGI)
Specification for transferring information
between a Web server and a CGI program.
Server only intelligent enough to send
documents and to tell browser what kind of
document it is.
 But server also knows how to launch other
programs.
 When server sees that URL points to a program
(script), it executes script and sends back
script’s output to browser as if it were a file.

29
© Pearson Education Limited 1995, 2005
CGI - Environment
30
© Pearson Education Limited 1995, 2005
CGI
CGI defines how scripts communicate with Web
servers.
 A CGI script is any script designed to accept
and return data that conforms to the CGI
specification.
 Before server launches script, prepares number
of environment variables representing current
state of the server, who is requesting the
information, and so on.
 Script picks this up and reads STDIN.

31
© Pearson Education Limited 1995, 2005
CGI
Then performs necessary processing and writes
its output to STDOUT.
 Script responsible for sending MIME header,
which allows browser to differentiate between
components.
 CGI scripts can be written in almost any
language, provided it supports reading and
writing of an operating system’s environment
variables.

32
© Pearson Education Limited 1995, 2005
CGI

Four primary methods for passing information
from browser to a CGI script:
–
–
–
–
Passing parameters on the command line.
Passing environment variables to CGI programs.
Passing data to CGI programs via standard input.
Using extra path information.
33
© Pearson Education Limited 1995, 2005
CGI - Passing Parameters on Command Line
34
© Pearson Education Limited 1995, 2005
CGI - Advantages
 CGI
is the de facto standard for interfacing Web
servers with external applications.
 Possibly most commonly used method for
interfacing Web applications to data sources.
 Advantages:
–
–
–
–
simplicity,
language independence,
Web server independence,
wide acceptance.
35
© Pearson Education Limited 1995, 2005
CGI - Disadvantages
 Communication
between client and database
server must always go through Web server.
 Lack of efficiency and transaction support, and
difficulty validating user input inherited from
statelessness of HTTP protocol.
 HTTP never intended for long exchanges or
interactivity.
 Server has to generate a new process or thread
for each CGI script.
 Security.
36
© Pearson Education Limited 1995, 2005
HTTP Cookies
 Cookies
can make CGI scripts more interactive.
 Cookies are small text files stored on Web client.
 CGI script creates cookie and has Web server
send it to client’s browser to store on hard disk.
 Later, when client revisits Web site and uses a
CGI script that requests this cookie, client’s
browser sends information stored in the cookie.
 Cookies can be used to store registration
information or preferences (e.g. for virtual
shopping cart).
 However, not all browsers support cookies.
37
© Pearson Education Limited 1995, 2005
Extending the Web Server
 To
overcome limitations of CGI, many servers
provide an API that adds functionality to server.
 Two of main APIs are Netscape’s NSAPI and
Microsoft’s ISAPI.
 Scripts are loaded in as part of the server, giving
back-end applications full access to all the I/O
functions of server.
 One copy of application is loaded and shared
between multiple requests to server.
38
© Pearson Education Limited 1995, 2005
Extending the Web Server
 Approach
more complex than CGI, possibly
requiring specialized programmers.
 Can provide very flexible and powerful solution.
 API extensions can provide same functionality as
a CGI program, but as API runs as part of the
server, API approach can perform significantly
better than CGI.
 Extending Web server is potentially dangerous,
since server executable is being changed.
39
© Pearson Education Limited 1995, 2005
Comparison of CGI and API
CGI and API both extend capabilities of server.
 CGI scripts run in environment created by
Web server program.
 Scripts only execute once Web server interprets
request from browser, then returns results back
to the server.
 API approach not nearly so limited in its ability
to communicate.
 API-based extensions are loaded into same
address space as Web server.

40
© Pearson Education Limited 1995, 2005
Java
Proprietary language developed by Sun.
 Originally intended to support environment of
networked machines and embedded systems.
 Now, Java is rapidly becoming de facto language
for Web computing.
 Interesting because of its potential for building
Web
applications
(applets)
and
server
applications (servlets).

41
© Pearson Education Limited 1995, 2005
Java
‘A
simple,
object-oriented,
distributed,
interpreted, robust, secure, architecture neutral,
portable, high-performance, multi-threaded
and dynamic language’.
 Has
a machine-independent target architecture,
the Java Virtual Machine (JVM).
 Since almost every Web browser vendor has
already licensed Java and implemented an
embedded JVM, Java applications can
currently be deployed on most end-user
platforms.
42
© Pearson Education Limited 1995, 2005
Java
43
© Pearson Education Limited 1995, 2005
Java
 Before
Java application can be executed, it must
first be loaded into memory.
 Done by Class Loader, which takes ‘.class’ file(s)
containing bytecodes and transfers it into
memory.
 Class file can be loaded from local hard drive or
downloaded from network.
 Finally, bytecodes must be verified to ensure
that they are valid and do not violate Java’s
security restrictions.
44
© Pearson Education Limited 1995, 2005
Java
speaking, Java is a ‘safe’ C++.
 Safety features include strong static type
checking, automatic garbage collection, and
absence of machine pointers at language level.
 Safety is central design goal: ability to safely
transmit Java code across Internet.
 Security is also integral part of Java’s design sandbox ensures untrusted application cannot
gain access to system resources.
 Loosely
45
© Pearson Education Limited 1995, 2005
Java 2 Platform
 In
mid-1999, Sun announced it would pursue a
distinct and integrated Java enterprise platform:
– J2ME: aimed at embedded and consumer-electronics
platforms.
– J2SE: aimed at typical desktop and workstation
environments. Serves as foundation for J2EE and
Web services.
– J2EE: aimed at robust, scalable, multiuser, and secure
enterprise applications.
 J2EE
was designed to simplify complex problems
with development, deployment, and management
of multi-tier enterprise applications.
46
© Pearson Education Limited 1995, 2005
Java 2 Platform
47
© Pearson Education Limited 1995, 2005
Java 2 Platform
 Cornerstone
of J2EE is Enterprise
JavaBeans (EJB), a standard for building
server-side components in Java.
 Three types of EJB components:
– EJB Session Beans, components implementing
business logic, business rules, and workflow.
– EJB Message-Driven Beans (MDBs), which process
messages sent by clients, EJBs, or other J2EE
components.
– EJB Entity Beans, components encapsulating some
data contained by the enterprise. Entity Beans are
persistent.
48
© Pearson Education Limited 1995, 2005
Java 2 Platform
 Two types of entity beans:
– Bean-Managed Persistence (BMP), which requires
developer to write code top make bean persist using
an API such as JDBC or SQLJ.
– Container-Managed Persistence (CMP), where
persistence is provided automatically by container.
 Discuss
5 ways to access a database:
JDBC, SQLJ, CMP, JDO, and JSP.
49
© Pearson Education Limited 1995, 2005
JDBC
 Modeled
after ODBC, JDBC API supports basic
SQL functionality.
 With JDBC, Java can be used as host language
for writing database applications.
 On top of JDBC, higher-level APIs can be built.
 Currently, two types of higher-level APIs:
– An embedded SQL for Java (e.g. SQLJ).
– A direct mapping of relational database tables to Java
classes (e.g. TopLink from Oracle).
50
© Pearson Education Limited 1995, 2005
JDBC
 JDBC
API consists of two main interfaces: an
API for application writers, and a lower-level
driver API for driver writers.
 Applications and applets can access databases
using:
– ODBC drivers and existing database client
libraries;
– JDBC API with pure Java JDBC drivers.
51
© Pearson Education Limited 1995, 2005
JDBC
52
© Pearson Education Limited 1995, 2005
JDBC - Advantages/Disadvantages
 Advantage
of using ODBC drivers is that they
are a de facto standard for PC database access,
and are available for many DBMSs, for very low
price.
 Disadvantages with this approach:
– Non-pure JDBC driver will not necessarily work with
a Web browser.
– Currently downloaded applet can connect only to
database located on host machine.
– Deployment costs increase.
53
© Pearson Education Limited 1995, 2005
SQLJ
 Another
JDBC-based approach uses Java with
static embedded SQL.
 SQLJ comprises a set of clauses that extend
Java to include SQL constructs as statements
and expressions.
 SQLJ translator transforms SQLJ clauses into
standard Java code that accesses database
through a CLI.
54
© Pearson Education Limited 1995, 2005
Comparison of JDBC and SQLJ
 SQLJ
is based on static embedded SQL while
JDBC is based on dynamic SQL.
 Thus, SQLJ facilitates static analysis for syntax
checking, type checking, and schema checking,
which may help produce more reliable programs
at loss of some functionality.
 It also potentially allows DBMS to generate an
execution strategy for the query, thereby
improving performance of the query.
55
© Pearson Education Limited 1995, 2005
Comparison of JDBC and SQLJ
JDBC is low-level middleware tool with features to
interface Java application with RDBMS.
 Developers need to design relational schema to
which they will map Java objects, and write code to
map Java objects to rows of relations.
 Problems:

– need to be aware of two different paradigms (object
and relational);
– need to design relational schema to map onto object
design;
– need to write mapping code.
56
© Pearson Education Limited 1995, 2005
EJBs




EJBs have 3 elements in common:
– an indirection mechanism;
– a bean implementation;
– a deployment description.
With indirection mechanism clients do not invoke EJB
methods directly.
Session and entity beans provide access to their
operations via interfaces.
home interface defines methods that manage lifecycle of
a bean. The corresponding server-side implementation
classes are generated at deployment time.
57
© Pearson Education Limited 1995, 2005
EJBs
 To
provide access to other operations, bean can
expose a local interface (if client and bean are
colocated), a remote interface, or both.
 Local interfaces expose methods to clients
running in same container or JVM.
 Remote interfaces make methods available to
clients no matter where deployed.
 When a client invokes create() method (which
returns an interface) on home interface, EJB
container calls ejbCreate() to instantiate bean, at
which point client can access bean through
remote or local interface returned by create().
© Pearson Education Limited 1995, 2005
58
EJBs
59
© Pearson Education Limited 1995, 2005
EJBs
Bean implementation is a Java class that implements
business logic defined in remote interface.
 Transactional semantics are described declaratively
and captured in the deployment descriptor.
 Deployment descriptor, written in XML, lists a
bean’s properties and elements, which may include:
– home interface, remote interface, local interface;
– Web service endpoint interface,
– bean implementation class,
– JNDI name for bean, transaction attributes,
security attributes, and per-method descriptors.

60
© Pearson Education Limited 1995, 2005
Container-Managed Persistence (CMP)
 Instead
of writing Java code to implement BMP,
CMP is defined declaratively in deployment
descriptor.
 At runtime, container manages bean’s data by
interacting with data source designated in
deployment descriptor.
 Following steps need to be followed for CMP:
–
–
–
–
Define CMP fields in local interface.
Define CMP fields in entity bean class implementation.
Define CMP fields in deployment descriptor.
Define PK field and its type in deployment descriptor.
61
© Pearson Education Limited 1995, 2005
Container-Managed Relationships (CMR)
 EJB
container can manage relationships between
entity beans and session beans.
 Relationships have a multiplicity, which can be 1:1,
1:M, or M:M, and a direction, which can be
unidirectional or bidirectional.
 Local interfaces provide foundation for CMR.
 With CMR, beans use local interfaces to maintain
relationships with other beans.
 For example, a Staff bean can use collection of
PropertyForRent local interfaces to maintain a
1:M relationship
 Container can also manage referential integrity.
62
© Pearson Education Limited 1995, 2005
Container-Managed Relationships (CMR)
 CMR
relationships are described declaratively in
deployment descriptor file outside enterprisebeans element.
 Need
to specify both beans involved in
relationship.
 Relationship is defined in ejb-relations element,
with each role defined in ejb-relationship-role
element.
 When bean is deployed, the container provider’s
tools parse deployment descriptor and generate
code to implement underlying classes.
63
© Pearson Education Limited 1995, 2005
EJB Query Language (EJB-QL)
 Used
to define queries for entity beans that operate
with CMP. EJB-QL can express queries for two
different styles of operations:
– finder methods, which allow results of an EJB-QL query
to be used by clients of the entity bean. Finder methods
are defined in home interface.
– select methods, which find objects or values related to
state of an entity bean without exposing results to client.
Select methods are defined in entity bean class.
 An
object-based approach for defining queries
against persistent store; conceptually similar to
SQL.
64
© Pearson Education Limited 1995, 2005
EJB Query Language (EJB-QL)
 As
with CMP and CMR fields, queries are defined
in the deployment descriptor.
 EJB container is responsible for translating EJBQL queries into query language of persistent store,
resulting in query methods that are more flexible.
<query>
<query-method>
<method-name>findAll</method-name>
<method-params></method-params>
</query-method>
<result-type-mapping>Local</result-type-mapping>
<ejb-ql><![CDATA[SELECT OBJECT(s) FROM Staff s]]></ejb-ql>
</query>
65
© Pearson Education Limited 1995, 2005
EJB Query Language (EJB-QL)
<query>
<query-method>
<method-name>findByStaffName</method-name>
<method-params>java.lang.String</method-params>
</query-method>
<result-type-mapping>Local</result-type-mapping>
<ejb-ql><![CDATA[SELECT OBJECT(s)
FROM Staff s WHERE s.name = ?1]]>
</ejb-ql>
</query>
66
© Pearson Education Limited 1995, 2005
Java Data Objects (JDO)

ODMG submitted their Java binding to Java Community
Process as basis of JDO. Development of JDO had two
major aims:
– To provide standard interface between application
objects and data sources, such as relational databases,
XML databases, legacy databases, and file systems.
– To provide developers with a transparent Java-centric
mechanism for working with persistent data to simplify
application development. (Aim of JDO was to reduce
need to explicitly code such things as SQL statements
and transaction management into applications).
67
© Pearson Education Limited 1995, 2005
Java Data Objects (JDO) - Interfaces




PersistenceCapable makes a Java class capable of being
persisted by a persistence manager. Every class whose
instances can be managed by a JDO PersistenceManager must
implement this interface.
Most JDO implementations provide an enhancer that
transparently adds code to implement this interface to each
persistent class.
The interface defines methods that allow an application to
examine runtime state of an instance and to get its associated
PersistenceManager if it has one.
PersistenceManagerFactory
obtains
PersistenceManager
instances. PMF instances can be configured and serialized for
later use.
68
© Pearson Education Limited 1995, 2005
Java Data Objects (JDO) - Interfaces




PersistenceManager contains methods to manage the
lifecycle of PersistenceCapable instances and is also the
factory for Query and Transaction instances.
A PersistenceManager instance supports one transaction at
a time and uses one connection to the underlying data source
at a time.
Query allows applications to obtain persistent instances
from data source. Can be many Query instances associated
with a PersistenceManager and multiple queries may be
designated for simultaneous execution.
This interface is implemented by each JDO vendor to
translate expressions in JDOQL into native query language
of data store.
69
© Pearson Education Limited 1995, 2005
Java Data Objects (JDO) – Interfaces and Classes





Extent is a logical view of all objects of a particular class
that exist in the data source.
Extents are obtained from a PersistenceManager and can be
configured to also include subclasses.
Extent has two possible uses: (a) to iterate over all instances
of a class; (b) to execute a query in the data source over all
instances of a particular class.
Transaction contains methods to mark start/end of
transactions.
JDOHelper class defines static methods that allow a JDOaware application to examine runtime state of instances and
to get its associated PersistenceManager if it has one.
70
© Pearson Education Limited 1995, 2005
JDO – Creating Persistent Classes
1.
2.
3.
Ensure each class has a no-arg constructor. If class has no
constructors defined, complier automatically generates a
no-arg constructor; otherwise, developer will need to
specify one.
Create a JDO metadata file to identify the persistent classes.
The JDO metadata file is expressed as an XML document.
Enhance classes so that they can be used in a JDO runtime
environment. JDO specification describes a number of ways
that classes can be enhanced, however, most common way is
using an enhancer program that reads a set of .class files
and JDO metadata file and creates new .class files that have
been enhanced to run in a JDO environment.
71
© Pearson Education Limited 1995, 2005
JDO – Reachability-based Persistence






JDO supports reachability-based persistence.
Thus, any transient instance of a persistent class will
become persistent at commit if it is reachable, directly or
indirectly, by a persistent instance.
Instances are reachable through either a reference or
collection of references.
Reachability algorithm is applied to all persistent instances
transitively through all their references to instances in
memory, causing the complete closure to become persistent.
Allows developers to construct complex object graphs in
memory and make them persistent simply by creating a
reference to graph from a persistent instance.
Instances have to be explicitly deleted.
72
© Pearson Education Limited 1995, 2005
JDO Query Language (JDOQL)
 Data
source-neutral query language based on Java
boolean expressions.
 Syntax is same as standard Java syntax, with a few
exceptions.
 A Query object is used to find persistent objects
matching certain criteria. A Query is obtained
through one of newQuery() methods of
PersistenceManager.
 Basic JDOQL query has following 3 components:
– a candidate class (usually a persistent class);
– a candidate collection containing persistent objects
(usually an Extent);
– a filter, a boolean expression in a Java-like syntax.
© Pearson Education Limited 1995, 2005
73
JDO Query Language (JDOQL)
 Query
result is a subcollection of candidate
collection containing only those instances of
candidate class that satisfy filter.
 Queries
can
include
optional
parameter
declarations that act as placeholders in filter string,
variable declarations, imports, and ordering
expressions.
Query query = pm.newQuery(PropertyForRent.class,
“this.rent < 400”);
Collection result = (Collection) query.execute();
74
© Pearson Education Limited 1995, 2005
Java Servlets
Servlets are programs that run on Java-enabled
Web server and build Web pages, analogous to
CGI.
 Have a number of advantages over CGI:

–
–
–
–
–
improved performance;
portability;
extensibility;
simpler session management;
improved security and reliability.
75
© Pearson Education Limited 1995, 2005
Java Server Pages (JSP)
Java-based server-side scripting language that
allows static HTML to be mixed with
dynamically-generated HTML.
 Compiled into Java servlet and processed by a
Java-enabled Web server (JSP works with most
Web servers).
 Since servlet is compiled, performance is
improved.

76
© Pearson Education Limited 1995, 2005
Java Web Services – Document-Oriented
Deal directly with processing XML documents.
 Java API for XML Processing (JAXP), processes
XML documents using various parsers and
transformations. JAXP supports both SAX and
DOM. Also supports the XSLT.
 Java Architecture for XML Binding (JAXB),
processes XML documents using schema-derived
JavaBeans component classes. JAXB provides
methods for unmarshalling an XML instance
document into a tree of Java objects, and
marshalling tree back into an XML document.

77
© Pearson Education Limited 1995, 2005
Java Web Services – Document-Oriented

SOAP with Attachments API for Java (SAAJ),
provides standard way to send XML documents
over Internet from Java platform. Based on
SOAP 1.1 and SOAP with Attachments, which
define a basic framework for exchanging XML
messages.
78
© Pearson Education Limited 1995, 2005
Java Web Services – Procedure-Oriented
Java API for XML-based RPC (JAX-RPC), sends
SOAP method calls to remote clients over Internet
and receives results.
 Client written in language other than Java can
access a Web service developed and deployed on
Java platform.
 Also, client written in Java can communicate with
service developed and deployed using some other
platform.

79
© Pearson Education Limited 1995, 2005
Java Web Services – Procedure-Oriented
Java API for XML Registries (JAXR), provides
standard way to access business registries and
share information.
 JAXR gives Java developers a uniform way to use
business registries based on open standards (such
as
ebXML)
or
industry
consortium-led
specifications (such as UDDI).

80
© Pearson Education Limited 1995, 2005
Microsoft Web Platform - .NET
“Software is delivered as a service, accessible by
any device, any time, any place, and is fully
programmable and personalizable.”
 Contains various tools, services, and technologies,
such as:
–
–
–
–
–
–
Windows 2000,
Exchange Server,
Visual Studio,
HTML/XML,
scripting languages,
components (Java, ActiveX).
81
© Pearson Education Limited 1995, 2005
Object Linking and Embedding for DataBases
(OLE DB)
Microsoft has defined set of data objects,
collectively known as OLE DB.
 Allows OLE-oriented applications to share and
manipulate sets of data as objects.
 OLE DB is an object-oriented specification based
on C++ API.
 Components can be treated as data consumers
and data providers. Consumers take data from
OLE DB interfaces and providers expose OLE
DB interfaces.

82
© Pearson Education Limited 1995, 2005
OLE DB Architecture
83
© Pearson Education Limited 1995, 2005
Active Server Pages (ASP)
ASP is programming model that allows
dynamic, interactive Web pages to be created on
server.
 ASP provides flexibility of CGI, without
performance overhead discussed previously.
 ASP runs in-process with the server, and is
optimized to handle large volume of users.
 When an ‘.asp’ file is requested, Web server
calls ASP, which reads requested file, executes
any commands, and sends generated HTML
page back to browser.

84
© Pearson Education Limited 1995, 2005
Active Server Pages (ASP)
85
© Pearson Education Limited 1995, 2005
ActiveX Data Objects (ADO)
 Programming
extension of ASP supported by
Microsoft IIS for database connectivity.
 Supports following key features:
–
–
–
–
–
–

Independently-created objects.
Support for stored procedures.
Support for different cursor types.
Batch updating.
Support for limits on number of returned rows.
Support for multiple recordsets.
Designed as an easy-to-use interface to OLE DB.
86
© Pearson Education Limited 1995, 2005
ADO Object Model
87
© Pearson Education Limited 1995, 2005
Remote Data Services (RDS)
Microsoft technology for client-side database
manipulation across Internet.
 Still uses ADO on server-side to execute query
and return recordset to client, which can then
execute other queries on recordset.
 RDS provides mechanism to send updated
records back to server.
 A disconnected recordset model.

88
© Pearson Education Limited 1995, 2005
Comparison of ASP and JSP
 Both
designed to enable developers to separate
page design from programming logic through use
of callable components.
 Differences:
– JSP is essentially platform and server independent
whereas ASP primarily restricted to MS Windowsbased platforms.
– JSP perhaps more extensible as JSP developers can
extend the JSP tags available.
– JSP components are reusable across platforms.
– JSP benefits from in-built Java security model.
89
© Pearson Education Limited 1995, 2005
Microsoft .NET

Number of limitations with Microsoft’s platform:
– a number of languages supported with different
programming models (J2EE composed solely of Java);
– no automatic state management;
– relatively simple user interfaces for Web compared to
traditional Windows user interfaces;
– need to abstract operating system (Windows API
difficult to program).

Next, and current, evolution in Microsoft’s Web
solution strategy was development of .NET.
90
© Pearson Education Limited 1995, 2005
Microsoft .NET
 Various
tools, services, technologies in .NET:
– Windows Server,
– BizTalk Server (to build XML-based business processes
across applications and organizations),
– Commerce Server (to build scalable e-Commerce
solutions),
– Application Center (to deploy and manage scalable Web
applications),
– Mobile Information Server (to support handheld
devices),
– SQL Server,
– Microsoft Visual Studio .NET
– Microsoft .NET Framework (CLR + Class Library).
91
© Pearson Education Limited 1995, 2005
.NET Framework
92
© Pearson Education Limited 1995, 2005
.NET – Common Language Runtime
 An
execution engine that loads, executes, and
manages code compiled into an intermediate
bytecode format - Microsoft Intermediate
Language (MSIL) - analogous to Java bytecodes.
 Not interpreted but compiled to native binary
format before execution by a JIT compiler built
into CLR.
 Allows one language to call another, and even
inherit and modify objects from another language.
93
© Pearson Education Limited 1995, 2005
.NET – Common Language Runtime



Provides number of services such as memory management,
code and thread execution, uniform error handling, and
security.
Enforces strict type-and-code-verification system called
common type system (CTS), which contains range of prebuilt data types representing both simple data types for
objects such as numbers and text values, and more complex
data types for developing user interfaces, data systems, file
management, graphics, and Internet services.
Also supports side-by-side execution allowing application to
run on single computer that has multiple versions of .NET
Framework installed, without application being affected.
94
© Pearson Education Limited 1995, 2005
.NET Framework Class Library


Collection of reusable classes, interfaces, and types that
integrate with CLR providing standard functionality such
as:
– string management, input/output, security management,
– network communications, thread management,
– user interface design features,
– database access and manipulation.
3 main components:
– Windows Forms to support user interface development.
– ASP.NET to support development of Web applications
and Web services. Reengineered version of ASP to
improve performance and scalability.
– ADO.NET to help applications connect to databases.
95
© Pearson Education Limited 1995, 2005
ADO.NET
 Designed
to address 3 main weaknesses with ADO:
– providing a disconnected data access model required for
Web;
– providing compatibility with .NET Framework class
library;
– providing extensive support for XML.
 Different
from connected style of programming
that existed in traditional 2-tier C-S architecture,
where connection was held open for duration of
program’s lifetime and no special handling of state
was required.
96
© Pearson Education Limited 1995, 2005
ADO.NET



Also ADO data model is primarily relational and could not
easily handle XML with a data model that is heterogeneous
and hierarchical.
Recognizing that ADO was a mature technology and widely
used, ADO has been retained in the .NET Framework,
accessible through the .NET COM interoperability services.
Two main layers:
– a connected layer (similar to ADO);
– a disconnected layer, the DataSet (providing a similar
functionality to RDS).
97
© Pearson Education Limited 1995, 2005
ADO.NET
98
© Pearson Education Limited 1995, 2005
ADO.NET Object Model
99
© Pearson Education Limited 1995, 2005
ADO.NET

Main replacements for ADO Recordset are:
– DataAdapter, acts as bridge between vendor-dependent
data source and vendor-neutral DataSet. While data
source may be RDB, may also be an XML document.
– DataReader, provides connected, forward-only, readonly stream of data from data source. A DataReader can
be used independently of a DataSet for increased
performance.
– DataSet, provides disconnected copies of records from
data source. DataSet stores records from one or more
tables in memory without holding a connection to the
data source, but unlike RDS DataSet maintains
information on relationships between tables and
constraints.
100
© Pearson Education Limited 1995, 2005
ADO.NET
 Several
ways a DataSet can be used:
– user can create DataTable, DataRelation, and Constraint
within DataSet and populate table with data
programmatically.
– user can populate DataSet with data from existing
relational data source using a DataAdapter.
– contents of DataSet can be loaded from an XML stream or
document, which can be either data, XML schema
information, or both.
 Also,
a DataSet can be made persistent using XML
(with or without a corresponding XML Schema).
101
© Pearson Education Limited 1995, 2005
Microsoft Web Services




.NET Framework built on number of standards to promote
interoperability with non-Microsoft solutions.
For example, Visual Studio .NET automatically creates
necessary XML and SOAP interfaces required to turn
application into a Web service.
In addition, .NET Framework provides set of classes that
conform to all the underlying communication standards, such
as SOAP, WSDL, and XML.
Microsoft UDDI SDK enables developers to add UDDI
functionality to development tools, installation programs, and
any other software that needs to register or locate and bind
remote Web services.
102
© Pearson Education Limited 1995, 2005
Microsoft Access and Web Page Generation

Access provides wizards
generating HTML/XML:
for
automatically
– Static pages: user can export data to HTML format.
– Dynamic pages using ASP: user can export data to an
‘asp’ file on Web server.
– Dynamic pages using HTX/IDC files: user can export
data to HTX/IDC files on server.
– Dynamic pages using data access pages: data access
pages are Web pages bound directly to data in the
database. Can be used like Access forms, except pages
are stored as external files.
– XML: data can be output as an XML document along
with associated schema and an XSL file.
103
© Pearson Education Limited 1995, 2005
Oracle Internet Platform
 Comprises
Oracle Application Server and
Oracle DBMS.
 It is n-tier architecture based on industry
standards such as:
– HTTP and HTML/XML for Web enablement.
– Java, J2EE, EJB, JDBC, and SQLJ for database
connectivity, Java servlets, and JSP. Also supports
JNDI and stored Java procedures.
– OMG’s CORBA technology.
– IIOP for object interoperability and RMI.
– Web services: SOAP, WSDL, UDDI, ebXML,
WebDav, LDAP.
104
© Pearson Education Limited 1995, 2005
Oracle Internet Platform
105
© Pearson Education Limited 1995, 2005
Oracle Application Server (OracleAS)
A
reliable, scalable, secure, middle-tier
application server designed to support
eBusiness.
 Currently available in three versions:
– Java Edition: lightweight Web server with minimal
application support;
– Standard Edition: for medium to large Web sites
that handle large volume of transactions;
– Enterprise Edition: Standard Edition + extras.
106
© Pearson Education Limited 1995, 2005
Communication Services
 Handles
all incoming requests received by
OracleAS, some processed by Oracle HTTP
Server and some by other areas of OracleAS.
 Oracle HTTP Server is extended version of
Apache Server.
107
© Pearson Education Limited 1995, 2005
Oracle HTTP Server Modules (mods)
 Oracle
has enhanced several of Apache mods, and
has added Oracle-specific ones; e.g.:
– mod_oc4j, routes HTTP requests for J2EE to
OracleAS Containers for J2EE (OC4J);
– mod_plsql, routes requests for stored procedures to
database server;
– mod_fastcgi, enhanced version of CGI that runs
programs in pre-spawned process;
– mod_oradav, provides support for WebDAV;
– mod_ossl, provides standard S-HTTP;
– mod_osso, enables transparent single sign-on.
108
© Pearson Education Limited 1995, 2005
OracleAS Containers for J2EE (OC4J)


A fully compliant J2EE 1.3 server.
Runs on J2SE and executes and manages J2EE
application components such as:
– Servlets
Servlet container provided that manages
execution of Web components and J2EE applications.
– JSPs JSP translator provided to convert JSP files into
Java source that container can then compile and
execute as a servlet.
– EJBs EJB container provided that manages execution
of EJBs for J2EE applications. Container has
configurable settings that customize the underlying
support , such as security, transaction management,
JNDI lookups, and remote connectivity. Container also
manages EJB lifecycles, database connection resource
pooling, data persistence, and access to J2EE APIs.
109
© Pearson Education Limited 1995, 2005
OracleAS Containers for J2EE (OC4J)
 OracleAS
supports both JDBC and SQLJ
database access mechanisms, and provides
following drivers:
– Oracle JDBC drivers, for use with Oracle database. Have
extensions to support Oracle-specific datatypes and to
enhance their performance.
– J2EE Connectors, part of J2EE platform, provide a
Java-based solution for connecting various application
servers and EISs.
– DataDirect Connect Type 4 JDBC drivers, for connecting
to non-Oracle databases.
110
© Pearson Education Limited 1995, 2005
Business Components for Java (BC4J)
A
Java and XML framework that enables
development, deployment, and customization of
multi-tier database applications from reusable
business components.
 Application developers can use BC4J to author
and test business logic in components that
automatically integrate with databases, reuse
business logic through SQL-based views, and
access/update these views from servlets, JSP, and
Java Swing clients.
 Applications can be deployed as either EJB
Session Beans or CORBA objects on OracleAS.
111
© Pearson Education Limited 1995, 2005
Presentation Services

These services deliver dynamic content to client
browsers, supporting servlets, JSP, Perl/CGI scripts,
PL/SQL pages, forms, and business intelligence.
– Oracle Forms Services, to run Oracle Forms over
Internet;
– OracleJSP, an implementation of Sun’s JSP;
– Oracle PSP (PL/SQL Server Pages), analogous to JSP,
but uses PL/SQL rather than Java for the server-side
scripting.
– Perl Interpreter, a persistent Perl runtime embedded in
Oracle HTTP Server.
112
© Pearson Education Limited 1995, 2005
Web Services and XML Support
 OracleAS
provides facilities for developing,
deploying, and managing Web services; e.g.:
– Web services can be developed using stateless and
stateful Java classes, stateless session EJBs, and
stateless PL/SQL stored procedures.
– Web Service HTML/XML Streams Processing Wizard
assists developers in creating an EJB whose methods
access and process HTML or XML streams.
– Web services can be integrated into both enterprise
and wireless portals, other Web services, databases,
legacy systems, and applications.
– OracleAS supports SOAP, WSDL, and UDDI.
113
© Pearson Education Limited 1995, 2005
TopLink
A
persistence framework that includes an objectrelational mapping mechanism for storing Java
objects and EJBs in a RDB.
 Provides solution to address complex differences
between Java objects and RDBs and enables
applications to store persistent Java objects in
any RDB supported by a JDBC driver.
 Includes Mapping Workbench, a visual tool to
map any object model to any relational schema.
114
© Pearson Education Limited 1995, 2005
Oracle Portal
 A portal
is Web-based application that provides
a common, integrated entry point for accessing
dissimilar data types on a single Web page.
 A portal is divided into a number of portlets.
 Oracle Portal provides a number of tools to
generate and customize portals and portlets.
115
© Pearson Education Limited 1995, 2005
Oracle Wireless
Provides services and tools for delivering information
and applications to mobile devices.
 Includes Multi-Channel Server (MCS) that supports
development of applications that are accessible from
multiple channels including wireless browsers, voice,
and messaging.
 MCS automatically translates applications written in
Oracle Wireless XML, XHTML Mobile Profile, or
XHTML+XForms for any device and network.
 Also allows portal sites to be created that use Web
pages,
Java
applications,
and
XML-based
applications.

116
© Pearson Education Limited 1995, 2005
Business Intelligence
 Functions
to track, extract, and analyze business
intelligence to support strategic decision-making:
– Oracle Reports Services enable users to run Oracle
Reports over Internet.
– Oracle Discoverer allows users to produce queries,
reports, and analysis of information from databases,
OLTP systems, and data warehouses using a Web
browser.
– Oracle Clickstream provides services to capture and
analyze aggregate information about Web site usage.
– Oracle Personalization enables users to track activity of
specific user and personalize information for that user.
117
© Pearson Education Limited 1995, 2005