37
1 PROJECT Web-based Database Applications Lecture 2: Web-based Databases Environment

1 PROJECT Web-based Database Applications Lecture 2: Web-based Databases Environment

  • View
    218

  • Download
    0

Embed Size (px)

Citation preview

1

PROJECTWeb-based Database Applications

Lecture 2: Web-based Databases Environment

2

The Web Environment & Web pages

Information presented on Web pages, can contain text, graphics, pictures, audio, and video

Web pages can also contain hyperlinks to other Web pages, which allow users to navigate in a non-sequential way through the information

Web environment: Hypermedia-based system that provides a simple ‘point and click’ means of browsing information

on the Internet using hyperlinks.

Connolly © Addison Wesley, 2002

3

The Web Environment (Continued)

Web consists of networks of computers that can act in two roles:

as clients (with browsers), requesting information

as servers, providing the information

The most used Protocol that governs exchange of information between the Web server and the browser is the HTTP

locations within documents are identified by URLs

Much of the Web’s success is due to its simplicity, uniformity of access, and platform-independence

Connolly © Addison Wesley, 2002

4

Basic Components of Web Environment

A Client is a machine or process that requested access to programs or data over the network

A Server provides and controls the access to programs and data, usually for multiple clients

Connolly © Addison Wesley, 2002

5

Summary of Basic Internet concepts - 1

World Wide Web (WWW) The total set of interlinked hypertext documents residing on

special servers called Web servers or HTTP servers, worldwide

Hyperlinks allow users to: Jump to other documents Download or transfer files Access to other groups and people Play audio / video files Execute small Java applets Execute servlets

© H. Afsarmansesh, 2003

6

Summary of Basic Internet concepts - 2

Browser Software that displays the HTML documents and supports

users with execution of commands and accessing databases

Web Server SW/HW that responds to requests from the browsers, transmits

HTML documents to browsers (or execute their commands)

Web pages – HTML documents Static Web pages: content established at development time Dynamic Web pages: content is dynamically generated,

usually by obtaining data from a database (using ODBC/JDBC)

Hoffer © Prentice Hall, 2002

7

Summary of Basic Internet concepts

ServletsHTML pages

Client

(browser)

Web server

response

request

retrieve

execute

© H. Afsarmansesh, 2003

8

E-Commerce / E-Business & Internet

Business transactions On line information provision on products/services and orders Order processing/fulfillment Interaction with Customers Electronic data interchange (e.g. EDI) Payment of bills

Electronic Commerce (e-commerce) Internet based business transactions buying or selling goods or services electronically

Electronic Business (e-business) Integration of Internet technology into economic infrastructure

of the business Development of integrated relationship among the customers

and suppliers via the Internet © H. Afsarmansesh, 2003

9

E-Commerce Categories

Business-to-BusinessBusiness-to-Business (B2B): Buy / sell transactions among businesses using Internet as the relationship channel

Business-to-CustomerBusiness-to-Customer (B2C): Businesses selling directly to customers

Customer-to-BusinessCustomer-to-Business (C2B): Customers taking initiative in buying and selling relationship

Customer-to-CustomerCustomer-to-Customer (C2C): Customers getting involved in buy / sell to other customers (e.g. Internet auctions)

Mobile E-CommerceMobile E-Commerce (M-C): Buy / sell via wireless access to the Internet

© H. Afsarmansesh, 2003

10

Benefits of Web-based applications to DBs - 1

HW/SW platform independence – for browsers

Location independence – for data

No installation necessary for clients – web access

Development time and costs are reduced

Maintenance cost is minimized – thin clients

Common, familiar interface across applications

Similar format/functionality for GUI interfaces

© H. Afsarmansesh, 2003

11

Benefits of Web-based applications to DBs - 2

Easy to integrate with existing applications- use of standards (HTML, XML, Java script)

Easy to add multimedia – use of standards

Access the same way to local and remote data

Public data is easily shared

Protected date is hidden behind the firewall or on a different server

Writing to DBs (adding new data) is now commonplace (e.g. on-line orders, paying for subscription) – e-commerce

© H. Afsarmansesh, 2003

12

Main challenges of Web-based applications for DBs

Security of on-line e-transactions To avoid users from purposely or maliciously destroying

the data- Communication security- Database security- …

E-business responsiveness / performance Proper & timely response to the business request

- Incomplete orders

- Semantic ambiguity- Efficiency- …

© H. Afsarmansesh, 2003

13

Growing number of Web servers worldwide

The web site: www.netcraft.com/survey provides a survey of web services on the Internet Showing the ever increasing usage of Apache Web server

In 1995 ~ 3500 sites

In 2001 ~ 25,000,000 sites

In 2003 ~ 45,000,000 sites

This growth is mostly due to the ability to communicate with the databases and other dynamic pages with on-line information.

Hoffer © Prentice Hall, 2002

14

Web Servers functionality

Provision of HTTP service to comunicate between Web servers and Web browsers

Transfer plain text via the TCP (Transmision Control Protocol) connection Supporting many clients simultaneously (multithreading and

multi-processing) Consisting several HTML pages and perhaps some servlets Load balancing approaches:

Using Domain Name Server (DNS)

- placing multiple copies of a web server on separate, but identical physical servers

One DNS => multiple IP addresses

Software/hardware balancing Request at one IP address is distributed to multiple servers

Reverse proxying Intercept client request and cache some response pages

Hoffer © Prentice Hall, 2002

15

Server-Side Extensions Adding functionality to the server ODBC/JDBC compliant DBMS (Oracle, Sybase SW/HW that interact directly with the Web server to

handle requests e.g. database-request handling middleware

ODBC/JDBC compliant DBMSs (Oracle, Sybase, …)

Web-to-database middleware

Hoffer © Prentice Hall, 2002

16

Client-Side Extensions

Adding functionality to the browser Plug-ins

HW / SW modules that extend the browser capabilities, by adding features (such as encryption, animation, wireless access, etc.)

Cookies Used to identify the user, when he/she returns to the web site Some blocks of data can be stored (by the Web server) at the

client site for later use

ActiveX(microsoft)–like extensions Components that allow some data manipulation inside the

Browser Hoffer © Prentice Hall, 2002

17

Web Server Interfaces

Common Gateway Interface (CGI) Specify transfer of information between Web server and

CGI program Not very good performance Security risks

Application Program Interface (API) More efficient than CGI Shared as dynamic link libraries (DLLs)

Java Servlets Like applets, but stored and running at the Web server Cross-platform compatible More efficient and secure than CGI

Hoffer © Prentice Hall, 2002

18

Some Structural aspects of the Internet

IP address DNS Domain names URL HTTP HTML Web Security

© H. Afsarmansesh, 2003

19

IP addresses and DNS

Internet Protocol addresses – IP addresses: Four numbers, ranging from 0 to 255, separated by periods

(e.g. 131.247.152.18). Identify a unique node (system) on the internet. Each IP address also maps to a unique domain name.

Domain Name Server (DNS) and Domain names Domain names are easy to remember, while IP addresses

are for the system usage (e.g. www.science.uva.nl). Domain name servers maintain an index of the IP

addresses and their matching domain names.

.com.gov .uk.edu .us

.duke.edu .sun.com .microsoft.com

.cs.unc.edu

.unc.edu

© H. Afsarmansesh, 2003

20

Uniform Resource Locators (URLs) - 1

URL is a string of alphanumeric characters representing a mnemonic name

Defines uniquely where documents (resources) can be found on the Internet

http://carol.wins.uva.nl/~netpeer/teaching/db-web/

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.

© H. Afsarmansesh, 2003

21

URLs - 2

URL consists of some basic parts: protocol used for the connection host name – Domain name path name on host where resource stored May include folder location and html file name (otherwise

the index default)

Can optionally specify: port through which the connection to host should be made query string

Connolly © Addison Wesley, 2002

22

HyperText Transfer Protocol (HTTP) - 1

It is based on request-response paradigm:

ConnectionConnection: Client establishes connection with Web Server

RequestRequest: Client sends HTTP request to Web server

ResponseResponse: Web server (via httpd) sends HTTP response (an HTML document) to client

CloseClose: Connection closed by Web server

Protocol used to transfer Web pages through Internet,between WWW server and clients programs

Connolly © Addison Wesley, 2002

23

HTTP - 2

In HTTP/1.0 - each connection itself is closed once server provides the response It is difficult to support the concept of a session,

which is essential to basic DBMS transaction HTTPS is a more secure version, providing

encryption and transmission through a secure net. TCP/IP (Transmission Control Protocol / Internet

Protocol) is used as the base for HTTP TCP/IP breaks long messages into smaller packets

routes them independently over the web at destination, it reassembles them for display on

the node’s browser.

Connolly © Addison Wesley, 2002

24

Sample HTTP Client Request / Response

GET /index.htmlUser-Agent: Mozilla/4.01Gold (NT; Windows NT) Host: dempsey.ils.unc.eduAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */* Content-Length: 55<mandatory blank line>

HTTP/1.0 200 OK

Date: Fri, 31 Dec 1999 23:59:59 GMT

Content-Type: text/html

Content-Length: 1354

<html>

<body>

<h1>Happy New Millennium!</h1>

(more file contents)

25

HyperText Markup Language (HTML)

A simple, yet powerful, platform-independent document language

HTML is an application of Standardized Generalized Markup Language (SGML), a system for defining structured document types and markup languages to represent instances of those document types

Document formatting language used to design most Web pages

Connolly © Addison Wesley, 2002

26

HTML - Common Tags

<HTML><!-- Our first Web page -->

<HEAD><TITLE>Databases & Web-based Applications</TITLE></HEAD><BODY>………….<P>Welcome to Our Web Site!</P>………….</BODY></HTML>

TagPair

A. Benabdelkader ©UvA, 2002

27

HTML - Text Styling (formatting)

<P>We have designed this site to teach

about the wonders of <EM>HTML</EM>. We have been using

<EM>HTML</EM> since <U>version<STRONG> 2.0</STRONG></U>,

and we enjoy the features that have been added recently. It

seems only a short time ago that we read our first <EM>HTML</EM>

book. Soon you will know about many of the great new features

of HTML 4.0.</P>

<H2 ALIGN = "center"><U>Welcome to Our Web Site!</U></H2>

As <I>

A. Benabdelkader ©UvA, 2002

Macro command

28

HTML - Headers

<H1>Level 1 Header</H1>

<H2>Level 2 header</H2>

<H3>Level 3 header</H3>

<H4>Level 4 header</H4>

<H5>Level 5 header</H5>

<H6>Level 6 header</H6>

HTML Code HTML Output

A. Benabdelkader ©UvA, 2002

29

HTML – Linking

• Web Site Link

• Email Link

My email address is <A HREF = "mailto: [email protected]"> my email </A>.

<P>Yahoo: <A HREF = "http://www.yahoo.com">Go to Yahoo</A></P>

A. Benabdelkader ©UvA, 2002

Link command

30

HTML – Forms (structured input box)

<H2>Input Form</H2>

<FORM METHOD="POST" ACTION="DBConnect.asp">

<B>Database Name:</B>

<INPUT NAME="DBName"><BR>

<INPUT TYPE="submit" VALUE="Connect">

</FORM>

A. Benabdelkader ©UvA, 2002

31

HTML - Special Characters

<!-- Special characters are entered using the form &code; -->

<P>All information on this site is <STRONG>&copy;</STRONG> Deitel <STRONG>&amp;</STRONG> Associates, 1999.</P>

&copy for copyrights symbol c

&amp for the symbol &

A. Benabdelkader ©UvA, 2002

32

HTML- FONTs, IMAGEs, …

<FONT COLOR = "red" SIZE = "+1" FACE = "Arial"> We have designed this site to teach about the wonders of <EM>HTML</EM>.</FONT>

<IMG SRC = "deitel.gif" BORDER = "1" HEIGHT = "144" WIDTH = "200" ALT = "Harvey and Paul Deitel">

A. Benabdelkader ©UvA, 2002

FONT

IMAGE

33

<html>

<head><Title>Databases & Web-based Applications</title></head>

<body bgcolor="#e1e8f8">

<h2 align="center">Databases &amp; Web-based Applications</h2>

<b><font size="4">Objectives</font></b><br>

Application of modern database architectures and data access mechanisms, …

<table border="1" width="100%" align="top" cellpadding="0" cellspacing="2" >

<tr><td><b><i>Directed to:</i></b></td>

<td>2e jaars bedrijfsinformatiesystemen</td></tr>

………...

<tr>

<td><b><i>Other Literature:</i></b></td>

<td>T. Connolly and C. Begg, Database systems: a practical approach to design, implementation, and management, 3rd ed: Addison Wesley, 2002.</td></tr>

</table>

<p style="line-height: 70%"><b><font size="4">Instructors</font></b>

<hr width="50%" align=left size=2>

<ul>

<li>C&eacute;sar Garita <img src="phone2.gif" align="absmiddle">

+31 (0) 20 525 75 33</font></li>

<li>Ammar Benabdelkader<img src="box028.gif" align="absmiddle">

<a href="Mailto:[email protected]">e-mail Me</a> </li>

</ul>

</body>

</html>

A. Benabdelkader ©UvA, 2002

Sample HTML Code

34

Sample HTML Output

A. Benabdelkader ©UvA, 2002

35

Summary of Internet-Related Languages Scripting languagesScripting languages

High level languages, interpreted, calls many functions from the host Hypertext Markup Language (HTML)Hypertext Markup Language (HTML)

Scripting (authoring) language for document display through browsers Standard Generalized Markup Language (SGML)Standard Generalized Markup Language (SGML)

1986 standard, to format, index, and link documents across applications Extensible Markup Language (XML)Extensible Markup Language (XML)

SGML-based, with customized tags for document sharing/transmission XHTML XHTML (to replace HTML in future)(to replace HTML in future)

An scripting language that extends HTML to make it XML-compliant JavaJava

General purpose OO programming language used for the web / applets JavaScript/VBScriptJavaScript/VBScript (also Perl and PHP)

Scripting languages that enable interactivity in HTML documents Cascading Style Sheets - CSS (also XSLT)Cascading Style Sheets - CSS (also XSLT)

W3C suggested formats for the appearance of Web page elements in HML documents

Hoffer © Prentice Hall, 2002

36

Basics of Internet, Intranet, and Extranet

Internet - Worldwide collection of interconnected networks

Intranet - Web site or group of sites belonging to an organization, accessible only by members of that organization (via a dedicated line or not)

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 the same organization, Extranet provides various levels of accessibility to outsiders

Connolly © Addison Wesley, 2002

37

Database-enabled intranet-internet environment

Hoffer © Prentice Hall, 2002

Clients Server