Database Connectivity and Server-Side Scripting Chapter 12.

Slides:



Advertisements
Similar presentations
Lecture plan Information retrieval (from week 11)
Advertisements

DT228/3 Web Development WWW and Client server model.
1 Chapter 12 Working With Access 2000 on the Internet.
Chapter Concepts Review Markup Languages
Session 6 Server-side programming - ASP. An ASP page is an HTML page interspersed with server-side code. The.ASP extension instead of.HTM denotes server-side.
15 Chapter 15 Web Database Development Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
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
Kashif Jalal CA-240 (072) Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 2 of…
Introduction to Web Application Architectures Web Application Architectures 18 th March 2005 Bogdan L. Vrusias
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic Server Side Web Technologies: Part 2.
Designing a Database Unleashing the Power of Relational Database Design.
Introduction to Web Interface Technology (CSE2030)
Introduction to Web Interface Technology (CSE2030)
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
Chapter 11 ASP.NET JavaScript, Third Edition. 2 Objectives Learn about client/server architecture Study server-side scripting Create ASP.NET applications.
1 Java Server Pages Can web pages be created specially for each user? What part does Java play?
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
Chapter 6: Hostile Code Guide to Computer Network Security.
Web-based Software Development - An introduction.
ODBC Open DataBase Connectivity a standard database access method developed by Microsoft to access data from any application regardless of which database.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB.
INTRODUCTION TO WEB DATABASE PROGRAMMING
Lecture 3 – Data Storage with XML+AJAX and MySQL+socket.io
 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
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.
Week 7 Lecture Web Database Development Samuel Conn, Asst. Professor
Chapter 16 The World Wide Web Chapter Goals Compare and contrast the Internet and the World Wide Web Describe general Web processing Describe several.
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.
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
Web Application Programming Carol Wolf Computer Science.
Chapter 17 - Deploying Java Applications on the Web1 Chapter 17 Deploying Java Applications on the Web.
Elements of ASP Documents Adapted from MCDN Web Workshop ( and Webmonkey’s Introduction to Active.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Tutorial 10 by Sam ine1020 Introduction to Internet Engineering 1 Database & Server-side Scripting Tutorial 10.
2-1 WEB DATABSE INTERFACING Colorado Technical University IT420.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Web Programming Brian Toone 8/27/2014. Outline for today 1.Understanding the architecture of the web 2.Overview of programming languages – Client-side.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Active Server Pages Server-Side Scripting and Client-Side Scripting.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
CITA 310 Section 7 Installing and Testing a Programming Environment (Textbook Chapter 7)
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.
WEB SERVER SOFTWARE FEATURE SETS
Database Connectivity with ASP.NET. 2 Introduction Web pages commonly used to: –Gather information stored on a Web server database Most server-side scripting.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
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.
Web-based Software Development - An introduction
ASP.NET Programming with C# and SQL Server First Edition
Accessing the Database Server: ODBC, OLE DB, and ADO
WWW and HTTP King Fahd University of Petroleum & Minerals
Chapter 27 WWW and HTTP.
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
Web Application Development Using PHP
Presentation transcript:

Database Connectivity and Server-Side Scripting Chapter 12

Learn how to… Define the technologies through which Web servers provide client access to server-side databases. Describe the three basic kinds of databases. List the steps in designing a relational database. Define a database connection object and SQL statement. Describe how server-side scripts make decisions based on dynamic database content.

Providing Web Access to Server-Side Databases

Access to Databases The three-tier Web application model consists of: –User interface –Business object –Back office databases Web sites that provide access to server- side databases are sometimes called HTTP gateways.

Access to Databases Data input by users in forms is sent to the business object. The business object can then retrieve, update, delete, or insert information in the database.

CGI The common gateway interface (CGI) defines the manner in which a form’s data, cookies, and other kinds of information in a Web request get submitted to the program or script that processes and responds to the request. CGI scripts typically reside in the cgi-bin directory. –CGI scripts can be written in any programming language. Perl is a scripting language for short programs. Bourne shell language is the original UNIX scripting language.

SAPI A Server Application Programming Interface (SAPI) is a collection of software components used by the business tier to obtain, process, and respond to a form’s data submitted by users. –SAPI loads once to process multiple requests. –CGI loads separately for each request. –Microsoft’s brand of SAPI is called Internet SAPI (ISAPI). –Netscape’s is called Netscape SAPI (NSAPI).

ASP Active Server Page (ASP) is a Microsoft ISAPI technology that enables Web developers to embed on a Web page server-side scripts written in either the JScript or VBScript programming language. –End users see only the result of the scripts, and not the scripts. See the next three slides for example.

ASP Source Code

Returned HTML Code

What the User Sees

Java Java is an object-oriented programming language that developers can use to create almost any kind of software. –Java code compiles into an intermediary language that executes on any platform running the JVM. Sun created Java but battles with Microsoft over legalities. –Microsoft can create its own version of Java. –Microsoft will include Sun’s Java Virtual Machine (JVM) in future versions of Windows.

Java Servlets and JSP A servlet is a Java applet that runs on the server instead of in the browser; hence the name. Java Server Page (JSP) is an active Web page technology that is Sun’s equivalent to Microsoft’s ASP. –JSP runs in the JVM (Java Virtual Machine). –ASP runs in Microsoft’s ISAPI.

PHP The PHP Hypertext Preprocessor (PHP) is another active page technology that enables the Web developer to include code on the page that will run on the server, which executes the code before sending the completed page to the user. –For more information, go to

ColdFusion ColdFusion is an active scripting technology that uses its own proprietary scripting language, the ColdFusion Markup Language invented by Macromedia. –ColdFusion pages have the filename extension.cfm, which stands for ColdFusion markup. –Visit for more information.

ASP.NET ASP.NET allows you to create code behind the Web page, on so-called code- behind pages that can be part of complete applications.

Understanding Databases

Flat File Database A flat file database keeps all the records in a single file. –It uses comma-delimited data or tab- delimited data to separate entries. –It contains one data table containing rows and columns.

Relational Database A relational database contains multiple tables with primary key columns through which the records in one table can relate (i.e. key) to the data in another table. –The primary key is a column in which every entry is unique. –A foreign key is a data field that relates the record to the table in which that same column occurs as a primary key. –The software that powers this type of database is called a relational database management system (RDBMS).

Relational Database

Object-Oriented Database In an object-oriented database, programmers write code in object-oriented languages to create complex data structures in which one data type can build upon, or inherit, properties from another. –The software is called an object-oriented database management system (ODBMS).

Designing Databases Here is an eight-step process to design a relational database: 1.Write a paragraph describing the purpose of the database. 2.Make a list of the tables that the database will comprise. 3.List the fields (data columns) each table will comprise.

Designing Databases 4.Indicate the kind of data (data type) that each column will hold. 5.Indicate which data columns are primary keys. 6.Indicate which data columns are foreign keys and state the name of the table and data column in which each foreign key is a primary key.

Designing Databases 7.Write a walkthrough to make sure you have not missed anything important. Describe how the typical user will enter your site and navigate its pages. State what will happen in the database as the user submits information. Explain how the data will be used onscreen to create pages whose content vary depending on the content of the database.

Designing Databases 8.If you have any data tables with no keys, ask yourself whether the data really stands alone. If not, add the necessary foreign key column to key the data to the primary key column of the data table to which it relates.

Normalizing Normalization is the process of separating a large table fulfilling multiple roles into smaller tables that increase efficiency by serving smaller roles that relate through keys to other tables in the database. –Normalized databases contain tables with fewer columns and are more efficient.

Indexing An index is a database column or collection of columns that the database engine uses to keep the data presorted in the order in which you plan to query it. –This increases performance.

Design Principles 1.Each table should have a column containing a unique row ID number. 2.A table should store data for a single type of entity. 3.A table should avoid columns that are allowed to contain null values. 4.A table should not have repeating values. 5.A field should have the same meaning in each row of a table. 6.Multiple instances of an entity should not be represented as multiple columns.

Accessing Server-Side Databases

Three-Tier Model

Major Databases The major brands of databases include Microsoft SQL Server, Oracle 9i, Borland Interbase, IBM DB2, and iPlanet Application Server. Standards define alternate means for connecting with databases. –ODBC –JDBC

ODBC Open database connectivity (ODBC) is a Microsoft standard database access method. –The goal is to make it possible for any application to access any database, regardless of its vendor. –ODBC uses database drivers that translate queries and commands issued by the application into a format that the database can process. –An ODBC driver exists for almost every brand of relational database.

JDBC Java database connectivity (JDBC) enables Java programs to communicate with SQL-based database systems.

OLE DB Data Sources Object linking and embedding database (OLE DB) enables Windows applications to open a wide variety of connections to data stored in all sources and not only in ODBC data sources.

ADO ActiveX Data Objects (ADO) is an API that enables business objects to make connections and issue commands against different kinds of data sources.

Creating an ADO Object The connection object is the ADO component that connects you to the database. –Once you have the connection open, you can execute queries that insert, update, retrieve, or delete records from the database. –The next slide shows the code to open a connection in two different ASP languages.

Creating an ADO Object

Sample Connection Strings

SQL The Structured Query Language (SQL) is an international standard that defines the syntax for issuing commands that can query, update, insert, or delete records in a database. The SELECT command is used to retrieve records from a data table.

SELECT Command

SELECT Order

SELECT Search

Creating Data-Driven Web Pages

Data-Drive Web Page A data-driven Web page is an HTML document in which part or all of the content derives from or depends on records or relationships in one or more databases. –Queries return data in a set of records called a recordset. –The next few slides show some ASP code that reads data from a recordset and makes decisions based on the status of this data.

Preface The following script reads the names of registered users from a Users table and prints the names onscreen. Each comment line begins with the symbol //

Jscript Version

VBScript Version

Using Logic The true power of data-driven Web pages comes from the script’s ability to make decisions based on the current contents of the database. –Suppose you want to check a user database to decide whether to allow a user to log on to gain access to a Web page. What steps would be needed?

Logical Steps for Login 1.Retrieve the user name and password from the incoming form data. 2.Open a connection to the username database. 3.Issue an SQL command to query the database. 4.Use an IF-THEN statement to make the following decision based on the query result: –If the recordset is empty, this user is not valid, so you deny access. –If the recordset contains the requested record, the user is allowed in.

JScript Version

VBScript Version