Top Banner
8A-1 NTW2000-T3 Databases and the Web An Introduction
30
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-1NTW2000-T3

Databases and the Web

An Introduction

Page 2: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-2NTW2000-T3

Why is ‘Databases on the Web’ Important? Databases are established technology for

managing large amounts of data The Web is a good way to present

information Separating data management from

presentation improves efficiencyupdatingfinding information

Credit: Netskills

Page 3: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-3NTW2000-T3

Examples of Websites Using Databases

Organizational information servicesemployee directories

Booking & schedulingairlines, university courses signup

Electronic commerce Website automation

www.yahoo.com www.webmonkey.com

Page 4: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-4NTW2000-T3

How to Integrate Databasesand the Web? Databases Integration tools

Page 5: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-5NTW2000-T3

Databases Database

an organized collection of data– paper-based

DBMS (database management system)– software to enable user to create and maintain databases

Relational database organizes data into tables RDBMS

Page 6: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-6NTW2000-T3

Examples of RDBMS

MS Access desktop

MySQL, mSQL mid-range

Oracle, Sybase, MS SQL Server large enterprise

Page 7: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-7NTW2000-T3

How to Integrate Databasesand the Web? Databases

MS Access MySQL, mSQL Oracle, Sybase, MS SQL Server

Integration tools PHP or CGI, Servlets, JSP, ASP etc. “Middleware”: e.g. ColdFusion

http://www.allaire.com/

Page 8: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-8NTW2000-T3

Application Interface to Databases

CGI Perl DBI Perl DBD (DBD::mysql)

ASP ODBC (Open DataBase Connectivity)

– A standard for the MS world

ODBC driver comes with database– MySQL supplies MyODBC

Servlets/JSP — JDBC

DBI

DBD::mysql DBD::oracle

CGI

Page 9: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-9NTW2000-T3

Relational Databases

Databases that organize data into tables Each table has

– A name(For identification)

– One or more columns(For attributes or fields)

– Rows (For entries or records)

Page 10: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-10NTW2000-T3

Relational Database Design

Logical database design Physical database design

Page 11: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-11NTW2000-T3

Logical Database Design(Entity-relationship modeling)

Identify and model the entities Identify and model the relationships

between the entities Identify and model the attributes Create unique identifier for each entity Normalize

Page 12: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-12NTW2000-T3

Terminology

Term DefinitionEntity A thing (person, place, event, etc.) which exists

outside of the database and is represented in it

Attribute Describes the properties of a particular entity

Relationship Describes the associations between two or more entities

Normalization Prevents inefficiency by ensuring no duplicated data in multiple tables

Page 13: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-13NTW2000-T3

Physical Database Design

Entities become tables Attributes become columns

choose appropriate data type for each column

Unique identifiers become primary keys Relationships are modeled as foreign keys

Foreign keys can be primary keys from other tables

Page 14: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-15NTW2000-T3

Structured Query Language (SQL)Standard language for working with relational databases A type of ‘natural’ language You may not have to write any code

There are tools for that e.g Access query tool But necessary to understand basics, as

SQL is common to all nearly all the tools covered today

Page 15: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-16NTW2000-T3

Two Categories of SQL Statement1. Data manipulation

• SELECT, INSERT, DELETE

2. Data definition• CREATE DATABASE, DROP DATABASE • CREATE TABLE, DROP TABLE

Page 16: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-17NTW2000-T3

SQL Statement: INSERT

INSERT INTO table

(col1, col2, col3, ...)

VALUES (‘text1’,’text2’...,num1,..);

mysql> INSERT INTO employee

-> (firstname, lastname, address,em_id)

-> VALUES(‘John’,’Doe’,’Somewhere’,1);

Page 17: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-18NTW2000-T3

SQL Statement: DELETE

DELETE FROM table

WHERE condition;

mysql> DELETE FROM employee

-> WHERE lastname=‘Jones’;

Page 18: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-19NTW2000-T3

SQL Statement: SELECTSELECT column_list

FROM table

WHERE condition;

mysql> SELECT * from course;

mysql> SELECT description

-> FROM course

-> WHERE title LIKE ‘Using%’;

Page 19: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-20NTW2000-T3

Use SELECT to join tablesSELECT table1.colx, table2.coly...

FROM table1, table2

WHERE condition;

mysql> SELECT course.title, course.description,

-> teacher.name

-> FROM course, teacher

-> WHERE course.teacher_ID=teacher.teacher_ID;

Page 20: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-21NTW2000-T3

Reference

Programming the Perl DBIhttp://www.oreilly.com/catalog/perldbi/chapter/ch04.html

Page 21: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-22NTW2000-T3

Page 22: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-23NTW2000-T3

The EndThe End

Page 23: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-24NTW2000-T3

Aside: Middleware

Adapted from Introduction to Distributed Systems: Slides for CSCI 3171 Lectures by E. W. Grundke

References: [TvS] A. Tanenbaum and M. van Steen

Distributed Systems: Principles and Paradigms, Prentice-Hall (2002)<URL:http://www.prenhall.com/divisions/esm/app/author_tanenbaum/custom/dist_sys_1e/>

[CDK] G. Coulouris, J. Dollimore and T. Kindberg Distributed System: Concepts and Design, Addison-Wesley (2001) <URL:http://www.cdk3.net/ig/beida/index.html>

Page 24: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-25NTW2000-T3

Layered Protocols: IPLayers, interfaces, and protocols in the Internet model.

Page 25: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-26NTW2000-T3

Layered Protocols: OSILayers, interfaces, and protocols in the OSI model.

2-1

TvS 2.2

Page 26: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-27NTW2000-T3

Middleware Protocols

An adapted reference model for networked communication.

2-5

TvS 2.6

Page 27: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-28NTW2000-T3

MiddlewareA software layer that

masks the heterogeneity of systems provides a convenient programming abstraction provides protocols for providing general-purpose

services to more specific applications, e.g. authentication protocols authorization protocols distributed commit protocols distributed locking protocols high-level communication protocols

– remote procedure calls (RPC)– remote method invocation (RMI)

Page 28: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-29NTW2000-T3

MiddlewareGeneral structure of a distributed system as middleware.

1-22

TvS 1.24

Page 29: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-30NTW2000-T3

Middleware and Openness

In an open middleware-based distributed system, the protocols used by each middleware layer should be the same, as well as the interfaces they offer to applications.

1.23

TvS 1.25

Page 30: 8A-1 NTW2000-T3 Databases and the Web An Introduction.

8A-31NTW2000-T3

Middleware programming modelsRemote Calls

remote Procedure Calls (RPC) distributed objects and Remote Method Invocation (RMI)

e.g. Java RMI

Common Object Request Broker Architecture (CORBA) cross-language RMI

Other programming models remote event notification remote SQL access distributed transaction processing

CDK Ch 1 End of Aside