The Web ◆ Web consists of netw ork of computers that can act in two roles: – as serv ers, providing information; – as clients brow sers, requesting information.. ◆ Protocol that gov e
Trang 1Chapter 29
Web Technology and DBMSs
Transparencies
Trang 2Chapter 29 - Objectives
◆ Basics of Internet, Web, HTTP, HTML, URLs.
◆ Advantages and disadv antages of Web as a
Trang 3Chapter 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.
Trang 4◆ Organizations using Web as strategic platform for innovative business solutions, in effect becoming
W eb-centric
© Pearson Education Limited 1995, 2005
Trang 5◆ 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.
Trang 6Internet
Worldw ide collection of interconnected networks.
◆ Began in late ‘60s in ARPANET, a US DOD project, investigating how to build networks that could w ithstand partial outages
◆ Starting with a few nodes, Internet estimated to have ov er 945 million users by end of 20 04
◆ 2 billion users projected by 20 10
◆ About 3.5 billion documents on Internet (550 billion if intranets/extranets included).
© Pearson Education Limited 1995, 2005
Trang 7Intranet and Extranet
◆ Intranet - Web site or group of sites belonging to an organization, accessible only by members of that
Trang 8eCommerce 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 transac tions 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.
© Pearson Education Limited 1995, 2005
Trang 9The Web
Hypermedia-based system that prov ides a simple
‘point and click’ means of brow sing information on the Internet using hyperlinks.
◆ Information presented on Web pages, which can contain text, graphics, pictures, sound, and v ideo
◆ Can also contain hy perlinks to other Web pages,
w hich allow users to navigate in a non-sequential
w ay through information
◆ Web documents written using HTML.
Trang 10The Web
◆ Web consists of netw ork of computers that can act
in two roles:
– as serv ers, providing information;
– as clients (brow sers), requesting information
◆ Protocol that gov erns exchange of information
betw een Web serv er and brow ser is HTTP and
locations w ithin documents identified as a URL.
◆ Much of Web’s success is due to its simplicity and platform-independence
© Pearson Education Limited 1995, 2005
Trang 11Basic Components of Web Environment
Trang 12HyperText Transfer Protocol (HTTP)
Protocol used to transfer Web pages through Internet.
◆ Based on request-response paradigm:
Connection - Cl ient establ ishes connection w ith Web server Request - Cl ient sends request to Web server.
Response - Web server sends response (HTML document)
to cl ient.
Cl ose - Connection cl osed by Web server.
© Pearson Education Limited 1995, 2005
Trang 13HyperText Transfer Protocol (HTTP)
◆ HTTP/1.0 is stateless protocol - each connection is closed once serv er prov ides response
◆ This makes it difficult to support concept of a session that is essential to basic DBMS transactions
Trang 14HyperText Markup Language (HTML)
Document formatting language used to design most Web pages.
◆ A simple, yet pow erful, 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.
© Pearson Education Limited 1995, 2005
Trang 15HyperText Markup Language (HTML)
Trang 16Uniform 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 serv ices.
© Pearson Education Limited 1995, 2005
Trang 17Uniform 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.
Trang 18Static 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 serv ers
◆ Need scripts that perform conv ersions from
different data formats into HTML ‘ on-the-fly ’
© Pearson Education Limited 1995, 2005
Trang 19◆ Based on open standards and focus on communication and collaboration among people and applications
◆ Unlike other Web-based applications, Web serv ices have no user interface and are not targeted for brow sers Instead, consist of reusable software components designed to be consumed by other applications
Trang 20Web 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
© Pearson Education Limited 1995, 2005
Trang 21Web Services
◆ Common example is stock quote facility, which receiv es a request for current price of a specified stock and responds w ith 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.
Trang 22Requirements for Web-DBMS Integration
◆ Ability to access v aluable 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 serv er.
◆ Connectivity solution that takes adv antage of all
the features of an organization’s DBMS.
© Pearson Education Limited 1995, 2005
Trang 23Requirements for Web-DBMS Integration
◆ Open architecture to allow interoperability with a
varie ty of sy stems and te chnologie s 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).
Trang 24Requirements 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-lev el productivity tools to allow
applications to be developed, maintained, and
deployed with relativ e ease and speed.
© Pearson Education Limited 1995, 2005
Trang 25Advantages of Web-DBMS Approach
Trang 26◆ Immaturity of development tools
© Pearson Education Limited 1995, 2005
Trang 27Approaches to Integrating Web and DBMSs
◆ Scripting Languages
◆ Common Gatew ay Interface (CGI).
◆ HTTP Cookies.
◆ Extending the Web Serv er.
◆ Java, J2EE, JDBC, SQLJ, JDO, Serv lets, and JSP.
◆ Microsoft Web Solution Platform: NET, ASP, and ADO.
◆ Oracle Internet Platform.
Trang 28Scripting Languages (JavaScript and VBScript)
◆ Scripting languages can be used to extend browser and Web server w ith database functionality
◆ As script code is embedded in HTML, it is downloaded ev ery time page is accessed
◆ Updating browser is simply a matter of changing Web document on serv er
◆ Some popular scripting languages are: Jav aScript, VBScript, Perl, and PHP
◆ They are interpreted languages, not compiled, making it easy to create small applications.
© Pearson Education Limited 1995, 2005
Trang 29Common Gateway Interface (CGI)
Specification for transferring information betw een a Web server and a CGI program.
◆ Server only intelligent enough to send documents and to tell brow ser what kind of document it is
◆ But serv er also knows how to launch other programs
◆ When serv er sees that URL points to a program (script), it executes script and sends back script’s output to browser as if it w ere a file.
Trang 30CGI - Environment
© Pearson Education Limited 1995, 2005
Trang 31◆ Before serv er launches script, prepares number
of env ironment v ariables representing current state of the server, who is requesting the information, and so on
◆ Script picks this up and reads STDIN
Trang 32CGI
◆ Then performs necessary processing and writes its output to STDOUT
◆ Script responsible for sending MIME header,
w hich allows browser to differentiate between components
◆ CGI scripts can be written in almost any language, prov ided it supports reading and writing of an operating system’s environment v ariables
© Pearson Education Limited 1995, 2005
Trang 33◆ Four primary methods for passing information from brow ser 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.
Trang 34CGI - Passing Parameters on Command Line
© Pearson Education Limited 1995, 2005
Trang 35CGI - Advantages
◆ CGI is the de facto standard for interfacing Web
serv ers with external applications.
◆ Possibly most commonly used method for interfacing Web applications to data sources
Trang 36◆ HTTP nev er intended for long exchanges or interactivity
◆ Serv er has to generate a new process or thread for each CGI script
◆ Security.
© Pearson Education Limited 1995, 2005
Trang 37HTTP Cookies
◆ Cookies can make CGI scripts more interactive
◆ Cookies are small text files stored on Web client
◆ CGI script creates cookie and has Web serv er send it to client’s brow ser 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 v irtual shopping cart).
Trang 38Extending the Web Server
◆ To overcome limitations of CGI, many servers prov ide 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 serv er, giv ing 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
© Pearson Education Limited 1995, 2005
Trang 39Extending the Web Server
◆ Approach more complex than CGI, possibly requiring specialized programmers
◆ Can provide v ery flexible and powerful solution
◆ API extensions can prov ide same functionality as
a CGI program, but as API runs as part of the serv er, API approach can perform significantly better than CGI
◆ Extending Web serv er is potentially dangerous, since server executable is being changed
Trang 40Comparison of CGI and API
◆ CGI and API both extend capabilities of serv er
◆ CGI scripts run in environment created by Web serv er program.
◆ Scripts only execute once Web serv er interprets request from browser, then returns results back
to the serv er
◆ API approach not nearly so limited in its ability
Trang 41Java
◆ Proprietary language dev eloped by Sun
◆ Originally intended to support env ironment of netw orked 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 (serv lets)
Trang 42Java
‘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 ev ery Web browser vendor has already licensed Jav a and implemented an embedded JVM, Java applications can currently
be deployed on most end-user platforms.
© Pearson Education Limited 1995, 2005
Trang 43Java
Trang 44◆ Class file can be loaded from local hard driv e or downloaded from network
◆ Finally, bytecodes must be verified to ensure that they are v alid and do not v iolate Java’s security restrictions
© Pearson Education Limited 1995, 2005
Trang 45◆ Loosely speaking, Jav a is a ‘safe’ C++
◆ Safety features include strong static type checking, automatic garbage collection, and absence of machine pointers at language lev el
◆ Safety is central design goal: ability to safely transmit Java code across Internet
◆ Security is also integral part of Jav a’s design - sandbox ensures untrusted application cannot gain access to system resources
Trang 46– J2SE: aimed at typical desktop and workstation
env ironments 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 dev elopment, deployment, and management
of multi-tier enterprise applications
© Pearson Education Limited 1995, 2005
Trang 47Java 2 Platform
Trang 48Java 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-Driv en 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.
© Pearson Education Limited 1995, 2005
Trang 49Java 2 Platform
◆ Two types of entity beans:
– Bean-Managed Persistence (BMP), which
requires developer to w rite code top make bean persist using an API such as JDBC or SQLJ
– Container-Managed Persistence (CMP) , where
persistence is prov ided automatically by container.
◆ Discuss 5 ways to access a database: JDBC, SQLJ, CMP, JDO, and JSP.