Top Banner
1 Chapter 29 Web Technology and DBMSs Transparencies
58

1 Chapter 29 Web Technology and DBMSs Transparencies.

Dec 23, 2015

Download

Documents

Howard Barnett
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 Chapter 29 Web Technology and DBMSs Transparencies.

1

Chapter 29

Web Technology and DBMSs

Transparencies

Page 2: 1 Chapter 29 Web Technology and DBMSs Transparencies.

2

Chapter 28 - Objectives

• Basics of Internet, Web, HTTP, HTML, URLs.• Difference between two-tier and three-tier

client-server architecture.• Advantages and disadvantages of Web as a

database platform.• Approaches for integrating databases into

Web:– Scripting Languages– Common Gateway Interface (CGI)– HTTP Cookies

Page 3: 1 Chapter 29 Web Technology and DBMSs Transparencies.

3

Chapter 28 - Objectives

– Extending the Web Server– Java and JDBC, SQLJ, Servlets, and JSP– Microsoft Web Solution Platform: ASP and

ADO– Oracle Internet Platform.

Page 4: 1 Chapter 29 Web Technology and DBMSs Transparencies.

4

Introduction

• Web: the 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.

Page 5: 1 Chapter 29 Web Technology and DBMSs Transparencies.

5

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.

Page 6: 1 Chapter 29 Web Technology and DBMSs Transparencies.

6

InternetWorldwide 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 100 million users in 1997, and over 390 million users in over 100 countries in 2001.

• May be 640 million users of Web by year 2003. • About 2.5 billion documents on Internet (550

billion if intranets/extranets included).

Page 7: 1 Chapter 29 Web Technology and DBMSs Transparencies.

7

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.

Page 8: 1 Chapter 29 Web Technology and DBMSs Transparencies.

8

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 $1.3 trillion by 2003.

• eCommerce may account for $3.2 trillion in worldwide corporate revenue by 2003 and could represent 5% of sales in the global economy.

Page 9: 1 Chapter 29 Web Technology and DBMSs Transparencies.

9

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.

Page 10: 1 Chapter 29 Web Technology and DBMSs Transparencies.

10

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.

Page 11: 1 Chapter 29 Web Technology and DBMSs Transparencies.

11

Basic Components of Web Environment

Page 12: 1 Chapter 29 Web Technology and DBMSs Transparencies.

12

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.

Page 13: 1 Chapter 29 Web Technology and DBMSs Transparencies.

13

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.

Page 14: 1 Chapter 29 Web Technology and DBMSs Transparencies.

14

HyperText Markup Language (HTML)

Document formatting language used to design most Web pages.

• 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.

Page 15: 1 Chapter 29 Web Technology and DBMSs Transparencies.

15

HyperText Markup Language (HTML)

Page 16: 1 Chapter 29 Web Technology and DBMSs Transparencies.

16

HyperText Markup Language (HTML)

Page 17: 1 Chapter 29 Web Technology and DBMSs Transparencies.

17

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.

Page 18: 1 Chapter 29 Web Technology and DBMSs Transparencies.

18

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

Page 19: 1 Chapter 29 Web Technology and DBMSs Transparencies.

19

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’.

Page 20: 1 Chapter 29 Web Technology and DBMSs Transparencies.

20

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.

Page 21: 1 Chapter 29 Web Technology and DBMSs Transparencies.

21

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).

• Cost-effective solution that allows for scalability, growth, and changes in strategic directions, and helps reduce applications development costs.

Page 22: 1 Chapter 29 Web Technology and DBMSs Transparencies.

22

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.

Page 23: 1 Chapter 29 Web Technology and DBMSs Transparencies.

23

Two-Tier Client-Server Architecture

Page 24: 1 Chapter 29 Web Technology and DBMSs Transparencies.

24

Three-Tier Client-Server Architecture

• Client side presented two problems preventing true scalability:– ‘Fat’ client, requiring considerable resources on

client’s computer to run effectively.– Significant client side administration overhead.

• By 1995, three layers proposed, each potentially running on a different platform.

Page 25: 1 Chapter 29 Web Technology and DBMSs Transparencies.

25

Three-Tier Client-Server Architecture

• Advantages: – ‘Thin’ client, requiring less expensive hardware.– Application maintenance centralized. – Easier to modify or replace one tier without

affecting others. – Separating business logic from database

functions makes it easier to implement load balancing.

– Maps quite naturally to Web environment.

Page 26: 1 Chapter 29 Web Technology and DBMSs Transparencies.

26

Three-Tier Client-Server Architecture

Page 27: 1 Chapter 29 Web Technology and DBMSs Transparencies.

27

Advantages of Web-DBMS Approach

• DBMS advantages• Simplicity• Platform independence• Graphical User Interface• Standardization• Cross-platform support• Transparent network access• Scalable deployment• Innovation

Page 28: 1 Chapter 29 Web Technology and DBMSs Transparencies.

28

Disadvantages of Web-DBMS Approach

• Reliability• Security• Cost• Scalability• Limited functionality of HTML• Statelessness• Bandwidth• Performance• Immaturity of development tools

Page 29: 1 Chapter 29 Web Technology and DBMSs Transparencies.

29

Approaches to Integrating Web and DBMSs

• Scripting Languages. • Common Gateway Interface (CGI).• HTTP Cookies.• Extending the Web Server.• Java, JDBC, SQLJ, Servlets, and JSP.• Microsoft Web Solution Platform: ASP and

ADO.• Oracle Internet Platform.

Page 30: 1 Chapter 29 Web Technology and DBMSs Transparencies.

30

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.

Page 31: 1 Chapter 29 Web Technology and DBMSs Transparencies.

31

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.

Page 32: 1 Chapter 29 Web Technology and DBMSs Transparencies.

32

CGI - Environment

Page 33: 1 Chapter 29 Web Technology and DBMSs Transparencies.

33

CGI - Passing Parameters on Command Line

Page 34: 1 Chapter 29 Web Technology and DBMSs Transparencies.

34

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.

Page 35: 1 Chapter 29 Web Technology and DBMSs Transparencies.

35

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.

Page 36: 1 Chapter 29 Web Technology and DBMSs Transparencies.

36

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.

Page 37: 1 Chapter 29 Web Technology and DBMSs Transparencies.

37

Server-Side JavaScript for Database Access

Page 38: 1 Chapter 29 Web Technology and DBMSs Transparencies.

38

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).

Page 39: 1 Chapter 29 Web Technology and DBMSs Transparencies.

39

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.

Page 40: 1 Chapter 29 Web Technology and DBMSs Transparencies.

40

import java.sql.*;import java.io.*;import java.util.*;public class Total1 {

public static void main (String[] arg) { try { Class.forName ("oracle.jdbc.driver.OracleDriver"); } catch (Exception e) { System.out.println("Could not load driver"); }

Page 41: 1 Chapter 29 Web Technology and DBMSs Transparencies.

41

// Connect to the database try { Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@orion.towson.edu:1521:cosc", “user_name",“password"); Statement stmt = conn.createStatement (); ResultSet rset=null; try { rset= stmt.executeQuery("SELECT * from department"); ResultSetMetaData rsmd=rset.getMetaData(); while (rset.next()) { System.out.println(" " + rset.getString(1) + " " + rset.getString(2) + " " + rset.getString(3) +" "); } }

Page 42: 1 Chapter 29 Web Technology and DBMSs Transparencies.

42

catch (SQLException e){ System.out.println("writetolog: error in SQL "+e+"<br>"); } } catch (SQLException e) { System.out.println("Something wrong " + e.toString());

}}}

Page 43: 1 Chapter 29 Web Technology and DBMSs Transparencies.

43

Java

Page 44: 1 Chapter 29 Web Technology and DBMSs Transparencies.

44

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. Essentially equivalent to JDK 1.2.– J2EE: aimed at robust, scalable, multiuser, and secure

enterprise applications.

• J2EE was designed to simplify complex problems with development, deployment, and management of multitier enterprise applications.

Page 45: 1 Chapter 29 Web Technology and DBMSs Transparencies.

45

Java 2 Platform• Cornerstone of J2EE is Enterprise JavaBeans

(EJB), a standard for building server-side components in Java.

• Two types of EJB components:– EJB Session Beans, components implementing

business logic, business rules, and workflow. – EJB Entity Beans, components encapsulating

some data contained by the enterprise. Entity Beans are persistent.

• From database perspective, interested in two J2EE components: JDBC and JSP.

Page 46: 1 Chapter 29 Web Technology and DBMSs Transparencies.

46

Java 2 Platform

Page 47: 1 Chapter 29 Web Technology and DBMSs Transparencies.

47

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. Java Blend from Sun).

Page 48: 1 Chapter 29 Web Technology and DBMSs Transparencies.

48

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.

Page 49: 1 Chapter 29 Web Technology and DBMSs Transparencies.

49

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.

Page 50: 1 Chapter 29 Web Technology and DBMSs Transparencies.

50

Java Server Pages (JSP)

• JSP is a Java-based server-side scripting language that allows static HTML to be mixed with dynamically-generated HTML.

• Behind scenes, JSP is 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.

Page 51: 1 Chapter 29 Web Technology and DBMSs Transparencies.

51

Microsoft Web Solution Platform

• Microsoft Web Solution Platform, a precursor to .NET, has been created for building and deploying interoperable Web solutions.

• Contains various tools, services, and technologies, such as:– Windows 2000, – Exchange Server, – Visual Studio, – HTML/XML, – scripting languages, – components (Java, ActiveX).

Page 52: 1 Chapter 29 Web Technology and DBMSs Transparencies.

52

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.

Page 53: 1 Chapter 29 Web Technology and DBMSs Transparencies.

53

OLE DB Architecture

Page 54: 1 Chapter 29 Web Technology and DBMSs Transparencies.

54

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.

• http://triton.towson.edu/~cscfr/htmlPage/

Page 55: 1 Chapter 29 Web Technology and DBMSs Transparencies.

55

Active Server Pages (ASP)

Page 56: 1 Chapter 29 Web Technology and DBMSs Transparencies.

56

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 Windows-based 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.

Page 57: 1 Chapter 29 Web Technology and DBMSs Transparencies.

57

Oracle Internet Platform

• Comprises Oracle Internet Application Server (iAS) and Oracle DBMS.

• It is n-tier architecture based on industry standards such as:– HTTP and HTML/XML for Web enablement.

– OMG’s CORBA technology.

– IIOP for object interoperability and RMI.

– Java, EJB, JDBC, and SQLJ for database connectivity, Java servlets, and JSP.

Page 58: 1 Chapter 29 Web Technology and DBMSs Transparencies.

58

Oracle Internet Platform