Computer Science 317 Database Management Introduction to Web Access to Databases.

Slides:



Advertisements
Similar presentations
17. Data Access ADO.Net Architecture New Features of ADO.NET
Advertisements

1 Introducing SQL Server  A Relational DBMS  A Powerful Client/Server DBMS Utilities range from:  Simple Database Creation/Maintenance To  Datawarehousing,
Web Forms and ASP.NET Programming Right from the Start with Visual Basic.NET 1/e 12.
ASP.NET (Active Server Page) SNU OOPSLA Lab. October 2005.
Chapter 10 ADO. What is ADO? ADO is a Microsoft technology ADO stands for ActiveX Data Objects ADO is a programming interface to access data in a database.
Introduction to Database Processing with ADO.NET.
15 Chapter 15 Web Database Development Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
Using Visual Basic 6.0 to Create Web-Based Database Applications
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Web Servers How do our requests for resources on the Internet get handled? Can they be located anywhere? Global?
Chapter 1: An Introduction To ASP.NET Web Programming
.NET’s CLR How does it really work? 7/2/20151Bhavani Sankar Ikkurthi CS 795 Presentation.
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
2. Developing in.NET and C#. 2 Microsoft Objectives “Microsoft.NET development is based on an underlying framework of tools and classes. These tools and.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
1 Introduction to Web Development. Web Basics The Web consists of computers on the Internet connected to each other in a specific way Used in all levels.
INTRODUCTION TO WEB DATABASE PROGRAMMING
Chapter 8 Binding Data to Web Controls. ASP.NET 2.0, Third Edition2.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
1..NET Architecture Based on slides by Joe Hummel.
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.
Databases and the Internet. Lecture Objectives Databases and the Internet Characteristics and Benefits of Internet Server-Side vs. Client-Side Special.
Introduction to ADO.Net and Visual Studio Database Tools ISYS 512.
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. WEB.
Meir Botner David Ben-David. Project Goal Build a messenger that allows a customer to communicate with a service provider for a fee.
Visual Studio ®.NET Data with XML Carlotta Eaton ( Associate Professor of IST New River Community College Slides by Microsoft Modified.
ASP.Net Web Applications. Characteristics of a typical data driven web application Web Server HTML Graphics Active-X Java Applets HTTP Request ADO / JDBC.
Using Visual Basic 6.0 to Create Web-Based Database Applications
Creating Web Applications Using ASP.NET Chapter Microsoft Visual Basic.NET: Reloaded 1.
ADO.NET A2 Teacher Up skilling LECTURE 3. What’s to come today? ADO.NET What is ADO.NET? ADO.NET Objects SqlConnection SqlCommand SqlDataReader DataSet.
Needs for Accessing Database To make your web site more dynamic and maintainable, you can display information on your web pages that are retrieved from.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
1..NET Architecture Based on slides by Joe Hummel.
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. WEB.
1 Introduction to ADO.NET Microsoft ADO.NET 2.0 Step by Step Rebecca M Riordan Microsoft Press, 2006.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Working with Disconnected Data The DataSet and SqlDataAdapter ADO.NET - Lesson.
1 Welcome to CSC 301 Web Programming Charles Frank.
Module 7: Accessing Data by Using ADO.NET
Introducing ASP.NET 2.0. Internet Technologies WWW Architecture Web Server Client Server Request Response Network HTTP TCP/IP PC/Mac/Unix + Browser (IE,
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Introduction to ADO.NET ADO.NET - Lesson 01  Training time: 10 minutes  Author:
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
ADO.NET Objects – Data Providers Dr. Ron Eaglin. Requirements Visual Studio 2005 Microsoft SQL Server 2000 or 2005 –Adventure Works Database Installed.
ASP.NET in Definition: 1.ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites,
ASP.NET (Active Server Page) SNU OOPSLA Lab. October 2005.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
1. The .NET Architecture 1. The .NET Architecture 2003
Module 3: Working with Local Data. Overview Using DataSets Using XML Using SQL Server CE.
Introduction and Principles Web Server Scripting.
HNDIT Rapid Application Development
Web Server By Bhupendra Ratha, Lecturer School of Library and Information Science Devi Ahilya University, Indore
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
Module 2: Using ADO.NET to Access Data. Overview ADO.NET Architecture Creating an Application That Uses ADO.NET to Access Data Changing Database Records.
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 1 Introduction to PHP Hypertext Preprocessor - PHP.
ADO .NET from. ADO .NET from “ADO .Net” Evolution/History of ADO.NET MICROSOFT .NET “ADO .Net” Evolution/History of ADO.NET History: Most applications.
.NET Data Access and Manipulation
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.
Lecture 1: The .NET Architecture
Introduction to Database Processing with ADO.NET
Introduction to Database Processing with ADO.NET
Introduction to ASP By “FlyingBono” 2009_01 By FlyingBono 2009_01
PHP / MySQL Introduction
Chapter 23 – ASP.NET Outline 23.1 Introduction NET Overview
Chapter 10 ADO.
Chapter 10 Accessing Database Files
Web Servers (IIS and Apache)
M S COLLEGE OF ART’S, COMM., SCI. & BMS Advance Web Programming
Introduction to ADO.Net and Visual Studio Database Tools.
Presentation transcript:

Computer Science 317 Database Management Introduction to Web Access to Databases

The Plan I. Introduction –General overview –One simple approach II..NET Overview III. ADO.NET Overview III. Examples with C#

Part I: Introduction

Why web access to database? Provides platform independent, remote access to the database –Data viewing –Data gathering

Web Browsers and Servers Web browser - This is a program that runs on your local PC (client). It allows you to request web pages from an internet host. 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.

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” Client-side scripts - Script engine on client machine builds parts of page when page is loaded by browser (date is simple example) Server-side scripts - Script engine on server builds parts of page before sending to client (database query results for example).

Typical Server-Side Request Client Web Server HTTP Request site Stars John Wayne Meg Ryan Interprets script code Performs action Fills in part of page 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 –Interprets script code –Does work dictated by this code (or has it done) –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 scripts) allows 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 Drivers/interfaces for scripting language to access the database

So, what are the pieces we use? Browser: Netscape or Internet Explorer Server machine: The Windows 2000 server that happens to house the SQL server. Web server: Microsoft IIS Database management system: SQL Server Programming: C# (VB.NET?) creating ASP.NET Database interface: ADO.NET

Part II:.NET Overview

Architecture Multi-language, virtual machine driven… Hardware Operating System Common Language Runtime (CLR) Your Application.NET Framework Class Library VBJ#C#C++…

CLR-based execution.NET applications are not stand-alone executable programs APP.exe other FxCL components CLR JIT Compiler obj code OS Process Underlying OS and HW Core FxCL

Implications? 1.Clients need CLR & FxCL to run.NET apps –available via Redistributable.NET Framework –two versions: v1.0 (2002) and v1.1 (2003) –20MB download –runs on 98 and above, NT (sp6a) and above included in Windows 2003, otherwise install via Windows update 2.Design trade-off… + managed execution (more secure, memory protection, etc.) + portability – slower execution?

Cross-platform Compiled.NET apps run on any supported platform: Your application ? Win64Win32 ( XP,2K,98) WinCE

Command-line development Option #1 is to use command-line tools….NET Framework SDK free (100 MB) complete set of command-line tools and docs development supported on Windows NT, 2000, XP Pro other platforms? –FreeBSD / Mac OS X via Rotor (i.e. SSCLI) –Linux via Mono project –Unix via dotGNU project

Part II: ADO.NET Overview

Introduction to ADO.NET This is the layer that allows us to communicate with the database. Everything is object oriented which is good Recall –Objects are defined by classes –Objects are instantiated by constructors that may have parameters –Objects have Properties or members that give them state Methods that give them behavior I will give some of the important classes (objects), and some of the properties and methods. Much more is available through the Visual Studio documentation.

ADO.NET Communications with SQL Server Console Application Interacts with Console Window Windows Application Interacts with Windows Form with controls Web Application ASP.NET page with HTML, scripting, controls ADO.NET data reader quick and simple read only ADO.NET dataset tables and relationships reading and writing ADO.NET command specifies data to send or receive ADO.NET connection Specifies data source, provider, security information SQL Server ADO.NET data adapter – reading, writing

SqlConnection Object Represents a connection to an SQL database –One member is a ConnectionString that contains information needed to connect to the database –Open method to open the connection using the connection string –There is a constructor that has connection string as parameter –Close method

SqlCommand Object Represents a command (SQL, T-SQL, Stored procedure) to execute against the database –CommandType StoredProcedure Text –CommandText Name of the stored procedure if type is StoredProcedure The SQL statement if type is Text –Connection –ExecuteReader method – sends CommandText to the connection and creates an SqlDataReader (Note: Does NOT open and close connection)

SqlDataReader Object Provides a means of reading a forward-only stream of rows from a SQL Server database. –Has properties like HasRows, FieldCount –Methods for getting column values of current row, depending on type. –Read method to move to next row. –Very efficient way and preferred if only reading

DataSet Object Datasets store data in a disconnected cache. The structure of a dataset is similar to that of a relational database; it exposes a hierarchical object model of tables, rows, and columns. In addition, it contains constraints and relationships defined for the dataset.

SqlDataAdapter Object Represents a set of data commands that are used to fill the DataSet and update a SQL Server database. –SelectCommand –UpdateCommand –InsertCommend –DeleteCommand –Fill method to fill DataSet table with data from SelectCommand –Update method used to update data in the database

Example program from handout When you drug the table onto the webform: –An SqlConnection and SqlDataAdapter were created –The connection was set to the database of the table –The SelectCommand of the adapter was set to select all rows from the table Then you generated a DataSet object You created a DataGrid object on the form –Set its DataSource to be the DataSet –Set its DataMember to be a tablename

Example program from handout (cont.) Hollywood MovieStar Connection DataSet myStars WebForm DataGrid DataAdapter SelectCommand

Example program from handout (cont.) Hollywood MovieStar Connection DataSet myStars WebForm DataGrid DataAdapter SelectCommand this.sqlDataAdapter1.Fill(dataSet11,”myStars”);

Example program from handout (cont.) Hollywood MovieStar Connection DataSet myStars WebForm DataGrid DataAdapter SelectCommand this.DataBind();

Example program from handout (cont.) Note: We’re only doing sequential read from the database table –Don’t need DataSet and DataAdapter for this –Just need Connection and Command (and DataReader) –Drag connection and command objects to the form. –Set the connection string correctly for connection object. –Set Command’s connection and CommandText

Example program from handout (cont.) private void Page_Load(object sender, System.EventArgs e) { this.sqlConnection1.Open(); this.DataGrid1.DataSource = this.sqlCommand1.ExecuteReader(); this.DataBind(); this.sqlConnection1.Close(); }