Download presentation
Presentation is loading. Please wait.
1
Web Technology and DBMSs
Chapter 29 Web Technology and DBMSs Pearson Education © 2014
2
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 Extending the Web Server Java, J2EE, JDBC, SQLJ, CMP, JDO, Servlets, and JSP Microsoft Web Platform: .NET, ASP, and ADO Oracle Internet Platform. 2 Pearson Education © 2014
3
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. 3 Pearson Education © 2014
4
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. 4 Pearson Education © 2014
5
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. 5 Pearson Education © 2014
6
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. U.S. online retail sales for 2011 approximately US$225 billion and projected to grow to US$362 billion by 2016. Global B2B market expected to be even greater than B2C, and B2B revenues expected to surpass B2C revenues many times over in the coming years. 6 Pearson Education © 2014
7
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. 7 Pearson Education © 2014
8
Basic Components of Web Environment
8 Pearson Education © 2014
9
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 - closed by Web server. 9 Pearson Education © 2014
10
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. 10 Pearson Education © 2014
11
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. 11 Pearson Education © 2014
12
HyperText Markup Language (HTML)
12 Pearson Education © 2014
13
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. 13 Pearson Education © 2014
14
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. 14 Pearson Education © 2014
15
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’. 15 Pearson Education © 2014
16
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. 16 Pearson Education © 2014
17
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 Map 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. 17 Pearson Education © 2014
18
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. 18 Pearson Education © 2014
19
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, RESTFul). Cost-effective solution that allows for scalability, growth, and changes in strategic directions, and helps reduce applications development costs. 19 Pearson Education © 2014
20
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. 20 Pearson Education © 2014
21
Advantages of Web-DBMS Approach
DBMS advantages Simplicity Platform independence Graphical User Interface Standardization Cross-platform support Transparent network access Scalable deployment Innovation 21 Pearson Education © 2014
22
Disadvantages of Web-DBMS Approach
Reliability Security Cost Scalability Limited functionality of HTML Statelessness Bandwidth Performance Immaturity of development tools 22 Pearson Education © 2014
23
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. 23 Pearson Education © 2014
24
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. 24 Pearson Education © 2014
25
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. 25 Pearson Education © 2014
26
CGI - Environment 26 Pearson Education © 2014
27
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. 27 Pearson Education © 2014
28
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. 28 Pearson Education © 2014
29
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. 29 Pearson Education © 2014
30
CGI - Passing Parameters on Command Line
30 Pearson Education © 2014
31
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. 31 Pearson Education © 2014
32
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. 32 Pearson Education © 2014
33
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). 33 Pearson Education © 2014
34
Extending the Web Server
To overcome limitations of CGI, many servers provide an API that adds functionality to server. Two of main APIs are Microsoft’s ISAPI and Apache Web Server API. 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. 34 Pearson Education © 2014
35
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. 35 Pearson Education © 2014
36
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. 36 Pearson Education © 2014
37
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. 37 Pearson Education © 2014
38
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 and Hibernate from Red Hat). 38 Pearson Education © 2014
39
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. 39 Pearson Education © 2014
40
JDBC 40 Pearson Education © 2014
41
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. 41 Pearson Education © 2014
42
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. 42 Pearson Education © 2014
43
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. 43 Pearson Education © 2014
44
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. 44 Pearson Education © 2014
45
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. 45 Pearson Education © 2014
46
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. 46 Pearson Education © 2014
47
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. 47 Pearson Education © 2014
48
Active Server Pages (ASP)
48 Pearson Education © 2014
49
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. 49 Pearson Education © 2014
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.