Databases Illuminated Chapter 13 Databases and the Internet.

Slides:



Advertisements
Similar presentations
Overview Environment for Internet database connectivity
Advertisements

WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Lecture plan Information retrieval (from week 11)
DT228/3 Web Development WWW and Client server model.
Introduction to XML CS348 Information System Guest Lecture Hazem Elmeleegy.
15 Chapter 15 Web Database Development Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
The Application Layer Chapter 7. Electronic Mail Architecture and Services The User Agent Message Formats Message Transfer Final Delivery.
INTERNET DATABASE Chapter 9. u Basics of Internet, Web, HTTP, HTML, URLs. u Advantages and disadvantages of Web as a database platform. u Approaches for.
Introduction to Web Database Processing
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic Server Side Web Technologies: Part 2.
INTERNET DATABASE. Internet and E-commerce Internet – a worldwide collection of interconnected computer network Internet – a worldwide collection of interconnected.
1 C. Shahabi Application Programming for Relational Databases Cyrus Shahabi Computer Science Department University of Southern California
Introduction to Web Interface Technology (CSE2030)
Chapter 14 Database Connectivity and Web Technologies
WWW and Internet The Internet Creation of the Web Languages for document description Active web pages.
1 The World Wide Web. 2  Web Fundamentals  Pages are defined by the Hypertext Markup Language (HTML) and contain text, graphics, audio, video and software.
Client-Server Processing and Distributed Databases
Web Design Basic Concepts.
Database Applications.  Database Programming  Web databases  Application architecture.
Electronic Commerce Last Week
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
INTRODUCTION TO WEB DATABASE PROGRAMMING
Computer Concepts 2014 Chapter 7 The Web and .
What is Web Design?  Web design is the creation of a Web page using hypertext or hypermedia to be viewed on the World Wide Web.
Getting connected.  Java application calls the JDBC library.  JDBC loads a driver which talks to the database.  We can change database engines without.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Copyright © cs-tutorial.com. Introduction to Web Development In 1990 and 1991,Tim Berners-Lee created the World Wide Web at the European Laboratory for.
Databases and the Internet. Lecture Objectives Databases and the Internet Characteristics and Benefits of Internet Server-Side vs. Client-Side Special.
Chapter 16 The World Wide Web Chapter Goals Compare and contrast the Internet and the World Wide Web Describe general Web processing Describe several.
Chapter 16 The World Wide Web. 2 The Web An infrastructure of information combined and the network software used to access it Web page A document that.
2013Dr. Ali Rodan 1 Handout 1 Fundamentals of the Internet.
Internet Basics Dr. Norm Friesen June 22, Questions What is the Internet? What is the Web? How are they different? How do they work? How do they.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Web Application Programming Carol Wolf Computer Science.
Chapter 6 The World Wide Web. Web Pages Each page is an interactive multimedia publication It can include: text, graphics, music and videos Pages are.
11/16/2012ISC329 Isabelle Bichindaritz1 Web Database Application Development.
Chapter 17 - Deploying Java Applications on the Web1 Chapter 17 Deploying Java Applications on the Web.
Fundamentals of Database Chapter 7 Database Technologies.
HTML, XHTML, and CSS Sixth Edition Chapter 1 Introduction to HTML, XHTML, and CSS.
Database Application Development SQL In Application Code : 1. Embedded SQL 2. Database API’s 3. SQLJ.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
1 Welcome to CSC 301 Web Programming Charles Frank.
WEB/DB1 DATABASE PROGRAMMING 3JDBC by the ASU Scholars.
Web Design (1) Terminology. Coding ‘languages’ (1) HTML - Hypertext Markup Language - describes the content of a web page CSS - Cascading Style Sheets.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
World Wide Web “WWW”, "Web" or "W3". World Wide Web “WWW”, "Web" or "W3"
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
IS-907 Java EE World Wide Web - Overview. World Wide Web - History Tim Berners-Lee, CERN, 1990 Enable researchers to share information: Remote Access.
JS (Java Servlets). Internet evolution [1] The internet Internet started of as a static content dispersal and delivery mechanism, where files residing.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Internet Applications (Cont’d) Basic Internet Applications – World Wide Web (WWW) Browser Architecture Static Documents Dynamic Documents Active Documents.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Database Connectivity and Server-Side Scripting Chapter 12.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
Chapter 1 Introduction to HTML, XHTML, and CSS HTML5 & CSS 7 th Edition.
Introduction to the World Wide Web & Internet CIS 101.
1 Chapter 22 World Wide Web (HTTP) Chapter 22 World Wide Web (HTTP) Mi-Jung Choi Dept. of Computer Science and Engineering
Database application development 1. Chapter 8 © 2013 Pearson Education, Inc. Publishing as Prentice Hall OBJECTIVES  Define terms  Explain three components.
1 LM 6 Database Applications Dr. Lei Li. Learning Objectives Explain three components of a client-server system Describe differences between a 2-tiered.
National College of Science & Information Technology.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
WWW and HTTP King Fahd University of Petroleum & Minerals
Chapter 15 Database Connectivity and Web Technologies
Chapter 27 WWW and HTTP.
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
Introduction to World Wide Web
Presentation transcript:

Databases Illuminated Chapter 13 Databases and the Internet

Uses for Web-based DB Applications e-commerce has pushed organizations to develop Web-based database applications –To create world-wide markets –To deliver information –To provide better customer service –To communicate with their suppliers –To provide training for employees –To expand the workplace –…Many other innovative activities

Databases and the WWW WWW is a loosely organized information resource Some websites use static linked HTML files – can become inconsistent and outdated Many organizations provide dynamic access to databases directly from the Web –introduces new problems for designers and DBAs –combination of communications technology, information retrieval technology and database technology –XML a standard for document storage, exchange, and retrieval.

Origins of The Internet Developed from Arpanet, communications network created in the 1960s by DARPA, US agency, for linking government and academic research institutions Used a common protocol, TCP/IP US National Science Foundation took over management of the network, then referred to as the Internet Navigating and using the Internet required considerable sophistication

World Wide Web Tim Berners-Lee proposed a method of simplifying access to Internet resources in 1989 Led to the development of the World Wide Web included notions of URL, HTTP, HTML, hypertext, graphical browsers with links Automated finding, downloading, and displaying files on the Internet

Browsers and URLs Browser- –software for searching, retrieving, presenting, and traversing resources on the WWW –Ex. Microsoft Internet Explorer, Mozilla Firefox, Google Chrome, Apple Safari and others URL –Uniform Resource Locator –Specific type of Uniform Resource Identifier (URI) –String giving the location of any type of resource on the Internet-Web pages, mailboxes, downloadable files, etc. –Gives protocol, server name, path name to resource

HTTP Communications protocol –Standard for structure of messages –HTTP request usually has a few lines of text Sample http interaction HTTP method field (GET or POST), URI of resource, HTTP version host header, with host name and HTTP port user agent line, shows the type of the client (optional) types of files the client will accept (optional) HTTP is a stateless protocol –No facility for remembering previous interactions –Creates a problem for e-commerce, which requires a continuous session with the user

HTML Data format used for presenting content on the Internet A markup language because HTML documents contain tags that provide formatting information for the text –Ex,,,,, and their ending tags HTML document can contain applets, audio files, images, video files, other content

XML Extensible Markup Language - standard for document storage, exchange, and retrieval Created in 1996 by the World Wide Web Consortium (W3) XML Special Interest Group Users can define their own markup language, with their own tags for data items in documents, including databases Can define the structure of heterogeneous databases supports translation of data between different databases

Components of XML Documents Element-the basic component Contains one or more XML elements –each with a start tag showing the name of the element, some character data, and an end tag Can have sub-elements-must be properly nested Can have attributes-names and values shown inside the element’s start tag Attributes occur only once within each element, while sub-elements can occur any number of times Comments can occur anywhere, can contain entity references-refer to external files, common text, Unicode characters, or reserved symbols

Well-Formed XML Document Obey rules of XML –Starts with XML declaration –Root element contains all other elements –All elements properly nested

HTML Document Showing Customer List in a Browser

XML Instance Document Showing Customer List

DTD and XML Schema Users can define their own markup language by writing either –A Document Type Declaration (DTD) A specification for a set of rules for the elements, attributes, and entities of a document A document that obeys the rules of its associated DTD is type-valid –An XML Schema New, more powerful way to describe the structure of documents A document that conforms to an XML schema is schema- valid

DTD Rules DTD is enclosed in each element is declared using a type declaration with structure In an element declaration, the name of any sub- element can be followed by one of the symbols *, + or ?, to indicate the number of times the sub-element occurs Attribute list declarations for elements are declared outside the element DTD can be external or internal (embedded in instance document)

DTD for CUSTOMERLIST

XML Schema Permits more complex structure than DTD Additional fundamental datatypes, UDTs User-created domain vocabulary Supports uniqueness and foreign key constraints Schema lists elements and attributes –Elements may be complex, which means they have sub- elements, or simple –elements can occur multiple times –Attributes or elements can be used to store data values –Attributes used for simple values that are not repeated Can validate schema at several websites See possible XML Schema for CustomerList on next slide

Three-tier Architecture Three major functions for an Internet environment: presentation, application logic, data management Placement of functions depends on architecture of system Three tier architectures completely separate application logic from data management –Client handles user interface, the presentation layer- first tier –Application server executes application logic -the middle tier –Database server forms the third tier Communications network connects each tier to the next

Advantages of 3-tier Architecture Allows support for thin clients that only handle the presentation layer Independence of tiers; may use different platforms Easier application maintenance on the application server Integrated transparent data access to heterogeneous data sources Scalability

Presentation Layer HTML forms often used at the presentation layer Scripting languages such as JavaScript, JScript, VBScript, may be embedded in HTML to provide some client-side processing Style sheets specify how data is presented on specific devices-CSS, XSL

Application Server Middle tier - responsible for executing applications –Determines the flow of control –Acquires input data from presentation layer –Makes data requests to database server –Accepts query results from database layer –Uses them to assemble dynamically generated HTML pages Server-side processing can use different technologies such as Java Servlets, Java Server pages, etc. CGI, Common Gateway Interface, can be used to connect HTML forms with application programs To maintain state during a session, servers may use cookies, hidden fields in HTML forms, and URI extensions. –Cookies generated at the middle tier using Java’s Cookie class, sent to the client, where they are stored in the browser cache

Data Layer Third layer is standard database or other data source Ideally on separate server

Oracle Web Programming PL/SQL Web Toolkit –Handles all three layers using PL/SQL PL/SQL Server Pages (PSP) –embed PL/SQL code in HTML pages JDBC –Application Programming Interface (API) standard for relational database access from Java And several other methods

PL/SQL Web Toolkit Allows user to access Oracle from a webpage –Using a browser, user sends request to a Web server, passing input values –Server sends a message to the database server, invoking a PL/SQL stored procedure in the Oracle database, passing parameters as needed. –Stored procedure invokes subprograms in the PL/SQL Web Toolkit, generating a Web page dynamically –Generated page is passed to the Web server –Web server displays the page in the client’s browser –Illustration on next slide

PL/SQL Web Toolkit

Web Toolkit htp Package Enter from SQL*Plus in usual way CREATE OR REPLACE PROCEDURE pagename IS BEGIN Functions generate HTML tags HTP.HTMLOPEN; HTP.HEADOPEN; HTP.TITLE(‘ ‘); HTP.HEADCLOSE; HTP.BODYOPEN; HTP.HEADER(n,‘ ‘ ); HTP.PARA; HTP.PRINT(' '); HTP.BODYCLOSE; HTP.HTMLCLOSE Inside the body, htp.formOpen (parameter list ) creates a form Form elements created using procedures htp.formText, htp.formCheckbox, htp.formRadio, htp.formTextarea, and others

PL/SQL Server Pages (PSP) provide the dynamic database content embed PL/SQL statements in HTML pages Write standard HTML scripts, using the delimiters to identify PL/SQL statements Can have Web Toolkit calls in the same application handled by the Oracle PL/SQL Web gateway (mod_plsql) reside on the server side PSP page is loaded into Oracle database space using utility program loadpsp Sample code shown on next slide

<%-- This example displays the last name and first name of every student in the University.Student table. --%> <%! CURSOR stu_cursor IS SELECT lastName, firstName FROM University.Student ORDER BY lastName; %> Student List Student List Last Name First Name A PSP Script to Display Student Names

JDBC API-standard for relational database access from Java Includes a set of Java classes and interfaces Oracle and other vendors have extended functionality Applications are platform independent Can run on a variety of servers and DBMSs.

JDBC Application Steps At the start of the application, import the Java classes import java.sql.*; For Oracle database add import oracle.jdbc; Load the JDBC drivers. For Oracle,write Class.forName(“oracle.jdbc.driver.OracleDriver”); Connect to the database using the DriverManager class - GetConnection method creates a connection object, which is used for all communication conn = DriverManager.getConnection("jdbc:oracle:oci8:url”,”yourId”,”yourpassword”); Use SQL to interact with the database and Java for the logic in the application program Close the connection object to disconnect from the database conn.close(); Sample code on next slide

Java Program Using JDBC import java.sql.*; import java.io.*; class Test{ public static void main(String args[]) { try { Class.forName("oracle.jdbc.driver.OracleDriver"); } catch (ClassNotFoundException e) { System.out.println("Cannot load OracleDriver"); } Connection conn = null; Statement stmt = null; ResultSet rset = null; try { conn = DriverManager.getConnection("jdbc:oracle:oci8","userId","password"); stmt = conn.createStatement(); rset = stmt.executeQuery("select stuid, lastName, firstName from Student"); while (rset.next()) System.out.println(rset.getString(1)+" " + rset.getString(2)+" "+rset.getString(3)); rset.close(); stmt.close(); conn.close(); } catch (SQLException e) { System.out.println("SQL error: " + e.getMessage()); }

The Connection Object Has 3 JDBC classes for communicating with database –Statement -for SQL statements with no parameters –PreparedStatement precompiled SQL statement – to be executed many times –CallableStatement -for executing stored procedures Has 3 methods to create instances of these classes –createStatement returns a new Statement object –prepareStatement takes an SQL statement, precompiles it, and stores it in a PreparedStatement object –prepareCall for call to a stored procedure; has methods for handling input and output parameters and executing the procedure;returns a CallableStatement Statement object is used for executing SQL statements –Methods executeUpdate, executeQuery. etc. –executeQuery method executes an SQL statement and returns a ResultSet object –ResultSet class has many useful methods; includes a cursor to present one row at a time –Within a row, columns can be retrieved using a get method