Computer Science 101 Web Access to Databases Overview of Web Access to Databases.

Slides:



Advertisements
Similar presentations
Web Forms and ASP.NET Programming Right from the Start with Visual Basic.NET 1/e 12.
Advertisements

DT228/3 Web Development WWW and Client server model.
1 Chapter 12 Working With Access 2000 on the Internet.
B.Sc. Multimedia ComputingMedia Technologies Database Technologies.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Introduction to Web Database Processing
Apache Tomcat Server – installation & use Server-side language-- use Java Server Pages Contrast Client-side languages HTML Forms Servers & Server-side.
DT211/3 Internet Development Application Internet Development Application.
Week 2 IBS 685. Static Page Architecture The user requests the page by typing a URL in a browser The Browser requests the page from the Web Server The.
Introduction to Web Interface Technology (CSE2030)
Multiple Tiers in Action
Apache Tomcat Server Typical html Request/Response cycle
Introduction to Web Interface Technology (CSE2030)
Chapter 11 ASP.NET JavaScript, Third Edition. 2 Objectives Learn about client/server architecture Study server-side scripting Create ASP.NET applications.
1 Chapter 20 — Creating Web Projects Microsoft Visual Basic.NET, Introduction to Programming.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
WEB DESIGN SOME FOUNDATIONS. SO WHAT IS THIS INTERNET.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
1 Web Servers (IIS and Apache) Outline 9.1 Introduction 9.2 HTTP Request Types 9.3 System Architecture 9.4 Client-Side Scripting versus Server-Side Scripting.
Chapter 9 Web Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
INTRODUCTION TO WEB DATABASE PROGRAMMING
9-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Computer Science 317 Database Management Introduction to Web Access to Databases.
Introduction to ASP.NET. Prehistory of ASP.NET Original Internet – text based WWW – static graphical content  HTML (client-side) Need for interactive.
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.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
Databases and the Internet. Lecture Objectives Databases and the Internet Characteristics and Benefits of Internet Server-Side vs. Client-Side Special.
Chapter 1: Introduction to Web
Chapter 16 The World Wide Web Chapter Goals Compare and contrast the Internet and the World Wide Web Describe general Web processing Describe several.
Server-side Scripting Powering the webs favourite services.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Chapter 17 - Deploying Java Applications on the Web1 Chapter 17 Deploying Java Applications on the Web.
Creating Web Applications Using ASP.NET Chapter Microsoft Visual Basic.NET: Reloaded 1.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
NASRULLAH KHAN.  Lecturer : Nasrullah   Website :
1 Data Bound Controls II Chapter Objectives You will be able to Use a Data Source control to get data from a SQL database and make it available.
HTML. Principle of Programming  Interface with PC 2 English Japanese Chinese Machine Code Compiler / Interpreter C++ Perl Assembler Machine Code.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Programming with Visual Web Developer Chapter 9.
 2004 Prentice Hall, Inc. All rights reserved. 1 Segment – 6 Web Server & database.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
Kingdom of Saudi Arabia Ministry of Higher Education Al-Imam Muhammad Ibn Saud Islamic University College of Computer and Information Sciences Chapter.
1 Welcome to CSC 301 Web Programming Charles Frank.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Introduction to JavaScript CS101 Introduction to Computing.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
The Module Road Map Assignment 1 Road Map We will look at… Internet / World Wide Web Aspects of their operation The role of clients and servers ASPX.
BlackBerry Applications using Microsoft Visual Studio and Database Handling.
IS-907 Java EE World Wide Web - Overview. World Wide Web - History Tim Berners-Lee, CERN, 1990 Enable researchers to share information: Remote Access.
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
Introduction and Principles Web Server Scripting.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
NASRULLAH KHAN.  Lecturer : Nasrullah   Website :
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
PROGRAMMING IN VISUAL BASIC.NET CREATING YOUR FIRST WEB APPLICATION Bilal Munir Mughal 1 Chapter-3.
COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP.
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.
Section 6.3 Server-side Scripting
WWW and HTTP King Fahd University of Petroleum & Minerals
Web Development Web Servers.
Introduction to Web Database By Rimpi Suman 1 1 Unit-6.
Chapter 27 WWW and HTTP.
An Introduction to JavaScript
Presentation transcript:

Computer Science 101 Web Access to Databases Overview of Web Access to Databases

Why web access to database? Provides platform independent, remote access to the database –Viewing data –Gathering data –Updating data

Client-Server Technologies Server: A program that provides services to other programs. It stands ready for requests and when it gets a request, it provides the service. Client: A program requesting a service of a server program. It makes a request, gets the service, and makes use of it.

Web Browsers and Servers Web server - This is a program that runs on the internet host computer (server). It takes requests for web pages from clients and delivers the pages back to the client. Web browser - This is a program that runs on your local PC (client). It allows you to request web pages from an internet host.

HTML and HTTP HyperText Markup Language - Allows “marking up” a document with tags specifying appearance and structure. HyperText Transfer Protocol - Protocol used for browsers to communicate with web servers. Basically, this consists of “requests” from the browser and “responses” from the server.

Typical HTTP Request Browser Web Server HTTP Request This is a web page Browser interprets HTML and displays page This is a web page Picture HTTP Response

Typical HTML Request Client Side (Browser) –Issues request for HTML page –Receives response HTML page –Interprets HTML and creates web page –Displays web page –Work is done here Server Side –Reads request from client –Finds page on server –Sends response page to client –Essentially a file server

Scripting Languages Scripting languages - Allow us to add capability to what’s provided by HTML. Allow parts of the page to be built “on the fly”. These scripts are “interpreted” as they run rather than being compiled. Client-side scripts - Script engine on client machine builds parts of page when page is loaded by browser (date is simple example). Javascript is prime example. Server-side scripts - Script engine on server builds parts of page before sending to client (database query results for example). ASP, PHP, JSP, Purl are examples.

Server Side Programs Here we have compiled programs that run on the server. Examples could be Java Servlets, ASP.NET languages such as C#

Typical Server-Side Request Client Web Server HTTP Request Stars John Wayne Meg Ryan Runs script or program on the server Sends response to client Stars John Wayne MegRyan Browser interprets HTML and displays page Gets Page

Typical Server-Side Request Client Side (Browser) –Issues request for HTML page –Receives response HTML page –Interprets HTML and creates web page –Displays web page Server Side –Reads request from client –Finds page on server –Runs server-side program needed –Alters HTML file –Sends response page to client

Web Access of Database The database resides on the server. Web pages with scripts (or calls to programs) allow the user to send database requests to the server. The server accesses the database to honor the requests. Results can be returned on an html page. Actions can take place on the database.

So, what are the pieces we need? Browser software on user machines A machine for the server Web server software on server Database management system on server Scripting/programming language for accessing the database – something supported by the web server

Web Applications: 3-Tier Architecture User Interface Application Logic - Program Database User Query SQL Query Results -HTMLQuery results Browser Local Machine Web Server with ASP.NET (C#) Access Database

The Big Picture – User Interface User Interface contains web components for user input or for displaying information returned from the database. Two types of components that we will use for displaying data in our examples will be GridViews and DropDownLists. GridViews provide row and column displays. They can be configured for really nice appearance, paging, etc. These components can have associated with them a data source – essentially a database query. We’ll keep it simple.

The Big Picture – Middle Tier The middle tier has program code to get users input, connect to the database, present request to the database, get results from the database, send results on to the interface. This is where the server side programming code would come in.

The Big Picture – Database Database receives requests in form of SQL statements or in form of request for stored query, performs the query and returns results to middle tier. You are already expert at this part, correct?

SQL Injection

Simple model – retrieving and displaying data from the database For now we are going to consider examples where we want the web page just to display information resulting from a query to the database. We’ll see that Visual Web Developer is very helpful with setting up connections to database, “binding” web components to data sources, etc.

Example1 – Faculty Information As a first example, let’s have a web page with a data grid displaying the faculty information – LastName, FirstName, Phone extension, and address. So we would –Start Visual Web Developer –Open our website –Create a new file (webform)

Example1 – Faculty Information (cont.) After placing any heading or whatever on the page, we drag a GridView onto the page from the Data Section of the ToolBox.

Example1 - Choosing the data source for the GridView New data source Access Database Browse for database

Example1 - Setting up the query

Example1 - Testing the query

Example1 - View the web page

Example1 - Modification Now let’s modify Example1 so that it displays information only for the advisors – department chairs who are not advisors will not appear. This only requires modifying the query associated with the grid view. To get to the query editor –Click on the grid view –Then click on the triangle in the upper right corner of the grid view. –Click on Configure data source

Example1 – Modifying the query There is nothing in the Faculty table to indicate whether or not a person is an advisor of one of our class members. We need to use the Student table as well as the Faculty table. SELECT DISTINCT F.LastName, F.FirstName, Phone, FROM Faculty F, Students S WHERE FacultyID = AdvisorID

Example1 – Modifying the query

Example2 - Majors To begin, we’ll have a drop down list with the various majors listed. The process is the same as before, put the drop down list on the page and configure the data source.

Data source for drop down list

Example2 – Viewing page with drop down list

Example2 – GridView with students Now let’s modify Example2 by adding a grid view that displays the names, class year, city, state and advisor fields for the students having the major selected from the drop down list. To have the selection in the drop down list take place, we need to have a way to force the page to “post back” to the server. We’ll use a button for now. It does nothing except that clicking a button causes the form to be “posted” to the server.

Example2 – Add GridView and Button

Example2 – Data Source for Grid View

Example2 – Testing the web page

Example2 – Adding advisors last name Now let’s modify the query so that we see the advisor’s last name rather than the advisor’s ID number.

Example2 – Testing the page

Example2 – Removing the button There is a property of drop down lists called AutoPostBack. The default value for this is false. If this value is set to true, the page will post back to the server whenever an item in the drop down list is selected. In Example2, we can set this property to true and remove the button. In many cases, we do not want that to happen since we may want to make several selection before having the action take place – make selections and then click button.

Example3 – Stored query Often it is easier to develop and test queries within the database itself as you did in lab. If we save these queries, they can be used in configuring a data source just like tables.

Example3 – Data source