Transcript Pclec09

Web Data Bases
In this lecture, we will be looking at
– The development and use of Intranets to share, or to
make available, information and communication to staff
– Additional responsibilities of Data Managers
– Web Servers
– The use of Web browsers to access data stored in
existing, or planned, databases in an Organisation
(American term - Enterprise)
– The need to organise information so that it can be
quickly and accurately used by people - perhaps now the
‘weak link’ in the Information chain ?
Where are Captain Kirk and Mr. Spock ?
WebDataBase / 1
Web Data Bases
• The term ‘Web Data Base’ is a misnomer - the Web (either
Internet or Intranet capabilities) is the means of linking
multiple databases, and thus supporting many users
• Data Management has a ‘central’ role
• Information can be cost-effectively available to many users
(stakeholders is a frequently used term)
WebDataBase / 2
Web Sourced Information
• Examples of ‘stakeholders’
– Customers tracking the status of goods (e.g. Books from
Amazon.com or CDs from CD-Now)
– Investors checking funds /shares performance
– Banking - status of Accounts, transfers, balances,
mortgages
– Suppliers/Contractors checking contract details or
accessing contract requirements
– Selection of Orthotics - as with the Caulfield Rehab
Centre
WebDataBase / 3
Web Sourced Information
• New skills for Data Managers - not Data Base
Administrators
– Information design
– Web site management
– Database applications for the Web
– Use of Java, XML, C# as application languages
– New technologies - Windows XP, .net
WebDataBase / 4
Web Sourced Information
Information Architecture:
Deals with the arrangements of ‘data elements’ into an
inter-related system
Has its basis in database query design
Web sites consist of pages - each page has the potential
of a variety of related information structures
text, hyperlinks, sounds, images, animation, colour
patterns (Portals are an example of a multi-type
document)
WebDataBase / 5
Web Sourced Information
There are 7 models for information organisation
–
–
–
–
–
–
Linear - a book or novel
Parallel - such as an airline timetable
Overlay - X-Ray, MRI, 3 dimensional display (cube)
Matrix - Calendar or similar display ( ? spreadsheet)
Web
- thesaurus (ability to move from word to word)
Hierarchical - tennis tournaments, business organisation
chart
– Spatial Zoom - ‘drilling’ through layers of information,
magnification or reduction of detail
WebDataBase / 6
Web Sourced Information
The models may be intertwined
A novel, or a report, may be linear (at the macro level) but
contain other model types at the micro (or detail) level.
A report probably will contain matrix organised tables.
It could also have an Hierarchical and a parallel data
content and display
WebDataBase / 7
Web Sourced Information
Information Design
The main objective of deign is to present or convey
meaning to the user
What is the design goal of a page ?
How can a collection of linked pages support the design
goals of a Web site ?
WebDataBase / 8
Web Sourced Information
Which organisation model(s) best ‘present’ information and who decides what is ‘best’ ?
Is user (stakeholder) consultation possible ?
necessary ?
Were you consulted when your favourite web page was
designed ?
Are we likely to be dependent on Web page design by a
remote agent ?
WebDataBase / 9
Some Web Basics
The Internet provides resource sharing among thousands
of networks
It is a ‘network of networks’
The Internet uses standard protocols to provide sharing
among different kinds of
computers,
operating systems,
communication equipment
WebDataBase / 10
Some Web Basics
There are 2 Protocols
– Transmission Control Protocol
– Internet Protocol
These protocols are known as TCP/IP
WebDataBase / 11
Some Web Basics
TCP/IP protocols are also used for private networks, known
as intranets
Normally, computers in an Intranet are not normally
accessible from computers in the Internet
An intranet (such as Monash University’s) can be protected
from outside access by a firewall
WebDataBase / 12
Some Web Basics
Client-server database access is necessary in intranets for
internal computing requirements.
Client-server database access in the Internet is normally for
outside parties - customers and suppliers
WebDataBase / 13
Intranet and Internet Relationship
Intranet
All connections TCP/IP
Firewall
Internet
WebDataBase / 14
Some Web Basics
Some terms:
HTTP - Hypertext Transfer Protocol - this establishes a
session between a browser and a Web server.
During a session, the browser and the server interact to
send and receive files which contain Web pages
Each page has a unique address - the Uniform Resource
Locator (URL).
WebDataBase / 15
Some Web Basics
URL:
The first part of a URL specifies the protocol of a service
The second part specifies a computer on the Internet which
contains the file. Communications devices (routers and
gateways) translate the second part unto a numeric IP
address
The third part specifies a path to a file containing the page
e.g. http://www.microsoft.com/products/default.html
http is the service
www.microsoft.com is the computer
products/default.html indicates the directory and the file
name of the page
WebDataBase / 16
Some Web Basics
Web pages are written in a language called
‘Hytertext Markup Language’ - HTML
(or are translated to this by Word Hyperlink, Front Page or
other software)
A browser displays pages on a PC by interpreting HTML
code in the file sent by a server.
Part of the HTML can contain ‘hyperlinks’ - or requests for
other pages
WebDataBase / 17
Some Web Basics
Web browsers support older Internet protocols
File Transfer protocol - FTP, used for transferring data files
such as word-processing documents and spreadsheets
.htm extension files - indicates older DOS based 3
character extension files e.g. /Myfile.htm
Creating HTML files - text editor (Windows Notepad)
HTML convertor (Microsoft Word)
HTML Editor - Microsoft Front Page
WebDataBase / 18
Some Web Basics
A fairly typical HTML Document Structure
<html>
<head>
<title> [Web page title text] </title>
</head>
<body>
[Web page content text and tags]
</body>
</html>
The beginning <html> and ending </html> paired tags
inform the Web browser that the enclosed text is to be
treated as a HTML document
WebDataBase / 19
Some HTML code
<html><head><title> Order Tracking</title></head>
<body>
<h1 align=center>Order tracking</h1>
<form action=‘Omit for now’>
<center><table width=“70%” border=“1”>
<tr><td width=“38%” align=“right”>
select a time period:</td>
<td width=“62%” align=“left”>
<input type=‘Radio” checked name=“optTime”
value=”week” within last week<br>
<input type=“Radio” name=“optTime” value=“month”> within last
month<br>
<input type=“Radio” name=“optTime” value=“year”>within last
year<br>
WebDataBase / 20
Some HTML Code
<input type=“radio” name=‘optTime” value=“All”>AllOrders</td></tr>
<tr><td> align=“center” colspan=“2”>
<b>or</b>&nbsp;
<b><small><I>(If an Order ID is entered,the selected time period will be
ignored)</small></I></td></tr>
<tr><td align=“right”
Enter an OrderID:</td>
<td align = “left”>
<input type=“text” name+”txtOrderid” size=“20”></td></tr>
</table>< br><input type=button name=“cmdSubmit”
value=“submit query”></center>
</form></body></html>
WebDataBase / 21
Some Web Basics
There are some limitations with HTML
– Content, structure and page formatting are mixed
together
– This leads to difficulties in searching for Web pages,
display Web pages in different formats for different
devices, and standardisation of Web page content
Therefore to support the rapid growth of the Web, the
ability to search, display and standardise Web pages
must improve
WebDataBase / 22
Some Web Basics
Enter from left with alarums (Shakespeare)
1. XML (eXtensible Markup Language and
2. XSL (eXtensible Style Language)
XML provides a clean separation between structure and
content of a document
The Document Type Declaration section of an XML
document provides field names, field properties, and also
the structure of the fields
WebDataBase / 23
Some Web Basics
XSL supports the transformation of of XML Documents into
HTML and other display languages
Both languages are extensible.
They support the development of industry-specific
standards for document content, structure and display
WebDataBase / 24
Web Page Request Cycle
5. Browser displays
file
1. User clicks hyperlink
2. Browser sends request
to Web server
4. Web server sends
file
3. Web server locates
page
WebDataBase / 25
XML and XSL Server/Browser
In the previous diagram, the server and/or the browser may
be able to processing XML and XSL in addition to HTML.
If the browser has XML and XSL processors, the server can
send XML and XSL to the browser instead of HTML
The browser can then transform the XML and XSL into
HTML and then display the HTML
If the browser does not contain XML and XSL, the server
can process the XML and XSL and send HTML to the
browser
WebDataBase / 26
Common Gateway Interface
This allows a Web server to communicate with an external
program, and to pass parameters to it (much like Segments
and packages in PL/SQL).
The external program then uses the passed parameters to
produce output which is sent back to the browser
The output normally contains HTML so that it can be
displayed properly by the browser
CGI is portable across most Web servers. The external
program may not be portable
WebDataBase / 27
Common Gateway Interface
The external program can be written in a compiled
language such as C, or an interpreted language such as
Perl
WebDataBase / 28
Common Gateway Interface
CGI offers several ways of providing database connectivity
In the ‘normal’ CGI approach, the external program sends
SQL statements to the database server and then encodes
the result in HTML or XML format
Parameters
Web Server
SQL
Database Server
External Program
HTML/XML
Results
WebDataBase / 29
Common Gateway Interface
In a ‘hybrid’ approach, the external program sends SQL
statements to a partner program which interacts with a
database server. This method generally provides better
performance - the partner program manages database
connections among multiple CGI processes and performs
some middleware functions
Parameters
Web Server
Parameters
External Program
HTML/XML
SQL
Partner Program
HTML/XML
Database Server
Results
WebDataBase / 30
Common Gateway Interface
However, there could be a catch - the hybrid CGI approach
may not scale to many simultaneous users (remember
concurrency ?)
A better approach is to add additional process management
functions in the Web server so that the Web server
communicates directly with the database server
and that of course is what we are going to look at next
WebDataBase / 31
Common Gateway Interface
The 2 terms which will be mentioned are
1. Server-side connectivity
and
2. Client-side connectivity
The 2 diagrams following may help to illustrate these
WebDataBase / 32
Server-Side Connectivity
This by-passes the external program needed with the CGI
approach.
There is direct communication between the Web server and
the database server
However, a specialised server may be needed to provide
the direct connection between the Web server and the
database server
This ‘special’ server supports management of simultaneous
users, support for transactions which span multiple Web
pages and message queuing
WebDataBase / 33
Server-Side Connectivity
SQL
Web server
with
middleware extension
Database
Server
HTML/XML
SQL Statements
and Formatting requirements
Database
WebDataBase / 34
Server-Side Connectivity
There is a limitation with the previous configuration
There is the need for a specialised Web server
This is overcome by a middleware server
The middleware contains a ‘listener’ component which
routes database requests to the middleware server
The middleware server provides transaction management
and queuing services
WebDataBase / 35
Server-Side Connectivity
Database
Request
SQL
Middleware
server with
Listener
Web Server
HTML/XML
SQL statements
and formatting
requirements
Database
Server
Results
Database
WebDataBase / 36
Server-Side Connectivity
The server-side approaches provide strong and robust
services for transaction processing as well as a software
bus for accessing and using remote objects
The specialised Web servers and the middleware servers
normally support many hundreds to thousands of
simultaneous users
Software buses are built into specialised Web servers and
Middleware servers and provide transparent access to
objects which are distributed across the Internet
WebDataBase / 37
Client-Side Connectivity
In the server-side approaches, the browser is limited to
interpretation of HTML
And even with the later versions of HTML which contain
scripting capabilities (DHTML), the client computing
capabilities may be underutilised
The client-side approach utilises available computing
capabilities without storing the code on the client
(remember cookies and donuts ?)
WebDataBase / 38
Client-Side Connectivity
In the following diagram, there are two very brief outlines to
enhance client interfaces for database processing
You have probably heard of Java - it’s a language intended
for embedded applications
You may have come also across ActiveX - An ActiveX
object is a binary file which can be executed directly on a
PC client.
WebDataBase / 39
Client-Side Connectivity
And a Java applet ? It is a ‘special’ program which executes
inside a virtual machine located in a Web browser - the
virtual machine prevents an applet from damaging the
resources of a PC. (strange but true)
A Web server sends a Java applet to a requesting Web
browser inside a PC client.
After receiving the applet, the Web browser executes it to
produce specified effects on the browser
WebDataBase / 40
Client-Side Connectivity
ActiveX
An ActiveX object is a binary file which can be executed
directly on a PC client.
No virtual machine is used for ActiveX objects
A Web server sends an ActiveX object as a result of a
request by a PC client
ActiveX objects can execute inside a browser or as
separate processes
WebDataBase / 41
Client-Side Connectivity - Web Page
Request Cycle
Browser sends request
to Web server
Web server sends file
containing HTML/XML
and embedded applet
(Java) or binary object
(ActiveX)
WebDataBase / 42
Client-Side Connectivity
Final Comments
The client-side approaches can be integrated with the
server-side approaches
This provides the advantages of a multiple-tier client-server
architecture with a customised interface on a PC client
PC clients remain thin, because the customisation code
(Applets and Objects) resides on a remote server.
PC clients can execute remote code on other servers
through Java or ActiveX code
WebDataBase / 43
Some Web Basics
Client-Server Computing with Middleware
Middleware
WebDataBase / 44
Some Web Basics
Two Tier Architecture
SQL Statements
Database
Server
Database
Query Results
WebDataBase / 45
Three Tier Architecture - Middleware
Server
SQL Statements
Middleware
Server
Database
Server
Query Results
WebDataBase / 46
Three Tier Architecture - Application
Server
SQL Statements
Database Server
Application Server
Query Results
WebDataBase / 47
Some Web Basics
Database access:
Additional servers and interactions assist the browser (or
extend its capabilities) and the web server functions of the
previous diagram
The Web server supports all (or mostly all) requests from a
browser
A Web server does not provide the same services as
database middleware
WebDataBase / 48
Middleware
So, what is this ‘middleware’
A major function of middleware is to support
‘interoperability’
Clients, and servers, can exist on platforms with different
hardware, operating systems, DBMSs and program
languages
Middleware allows a client and server to ‘be aware’ of each
other and to communicate without knowledge of each
other’s platform
WebDataBase / 49
Middleware
Another function of middleware is efficient message control
Normally in a client-server environment there are many
clients communicating with a lesser number of servers
(remember that a ‘server’ can become a ‘client’ can become
a ‘server’)
A server can become overloaded managing messages
rather than performing the process tasks requirements
WebDataBase / 50
Middleware
Middleware frees up servers from managing request
messages and allows servers to concentrate on the
processes associated with completing requests for services
Middleware can perform queuing, scheduling and message
routing
This allows clients and servers to work at different speeds
and times (sounds like the functions of an operating
system ?)
WebDataBase / 51
Middleware
Types of middleware
1. Transaction processing monitors - These relieve the
operating system of managing database processes. A
transaction processing monitor can switch control among
processes much faster than an Operating system (any
ideas why this is so ?)
A transaction processing monitor receives transactions,
schedules them, and manages them until the process is
complete.
Transaction processing monitors also get involved with
updating multiple databases, and multiple sets of data, in a
single transaction - remember a ‘database transaction ?)
TPM’s are the oldest form of middleware
WebDataBase / 52
Middleware
2. Message orientated middleware - these maintain queues
of messages (based on queuing theory).
A client process can place a message on a queue and a
server process can remove a message from a queue
The major difference between Type 1 (transactionprocessing middleware) and Type 2 is in the ‘intelligence’
of the messages. (which tends to be the way in which
software becomes ‘smarter’ as in say MS2000 and MS XP
operating systems)
WebDataBase / 53
Middleware
Transaction processing monitors provide built-in intelligence
but use simple messages
Message orientated middleware provides less built-in
intelligence but support more complex messages
3. Object-request brokers - these provide a high level of
interoperability and message intelligence. Object-request
broker messages must be encoded in a standard interface
language
An object-request broker (ORB) resolves platform
differences between a client and a server
A client can communicate with a server without knowing the
location of a server (Corba, D-Comm)
WebDataBase / 54
Connectivity Summary
Approach
Straight CGI
Product
Apache Web server with external
PERL program
Hybrid CGI
Apache Web server with Cold Fusion
server extensions
Extended Web
Internet Information Server with
server (server-side Microsoft Transaction Server
connectivity)
Middleware-server Oracle Application Server
(server side connectivity)
Client-side
Microsoft Remote Data Service,
connectivity
Java relational Model Interface
WebDataBase / 55
Client Side Scripts
Scripts are used for data validation within HTML forms
In many cases HTML form inputs do not require large
applications and the script will be faster than creating a
compiled program
Scripts can be modified using a script editor
Modifying a compiled program means that the necessary
programming environment must be installed on the user
workstation, the original source code must also be
available, and after the source code is modified, the
program must be recompiled, tested and finally, included in
the system library
WebDataBase / 56
Client Side Scripts
Server side scripts are created using Active Server pages
commonly known as ASPs
JavaScript is a client side scripting language. It is supported
by Netscape Navigator and Microsoft Internet Explorer
JavaScript syntax is similar to C, C++ and Java
JavaScript client-side scripts can be added to standard
HTML Web pages using special HTML tags
WebDataBase / 57
Client Side Scripts
The following code ensures that a user has entered a name
in a form input box
<html>
<head>
<title> Monash Traders - Order Tracking</title>
</head>
<body>
<h2>Monash Traders - Order Tracking<h2>
WebDataBase / 58
Client Side Scripts
<script language = “JavaScript”>
<! -- hide this script from old browsers
Function validate(){
if (document.login.username.value ==“”) {
alert (“Please enter your name!”)
return
}
alert (“ Thanks for entering your name, “ +
document.login.username.value + “!”
document.login.submit()
}
//-->
</script>
WebDataBase / 59
Client Side Scripts
<form name=“login” onsubmit=“validate()”>
please enter your name:
<input type= “text” name+ “username” size=“20”
<input type=“submit”>
</form>
</body>
</html>
WebDataBase / 60
Scripting Languages
Server side scripts:
An ASP is a text file (.asp) and contains server-side script
commands which can perform tasks such as inserting,
updating, and retrieving data from a database.
An ASP also contains HTML commands for creating a
formatted Web page
ASPs are Microsoft specific technology, and can only be
processed on Microsoft Web servers (Personal Web
Server, MS Internet Information Server). Netscape has
server-side scripting technology called LiveWire which is
similar to Active Server Pages
WebDataBase / 61
Server-Side Scripts
And finally :Scripts within ASPs can be created using VBScript (the
default ASP scripting language), and Jscript (Microsoft’s
JavaScript implementation)
and ASPs are processed on a Web server and files must be
stored and run from a folder on the Web server - they
cannot be displayed from a folder on the user’s workstation
using a file URL.
WebDataBase / 62