Professional Documents
Culture Documents
An Introduction
NTW2000-T3 8A-1
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 efficiency
updating
finding information
NTW2000-T3 8A-4
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
NTW2000-T3 8A-5
Examples of RDBMS
MS Access
desktop
MySQL, mSQL
mid-range
Oracle, Sybase, MS SQL Server
large enterprise
NTW2000-T3 8A-6
How to Integrate Databases
and 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/
NTW2000-T3 8A-7
Application Interface to
Databases
CGI CGI
Perl DBI DBI
Perl DBD (DBD::mysql)
DBD::mysql DBD::oracle
ASP
ODBC (Open DataBase Connectivity)
– A standard for the MS world
ODBC driver comes with database
– MySQL supplies MyODBC
Servlets/JSP — JDBC
NTW2000-T3 8A-8
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)
NTW2000-T3 8A-9
Relational Database Design
NTW2000-T3 8A-10
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
NTW2000-T3 8A-11
Terminology
Term Definition
Entity 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
NTW2000-T3 8A-12
Physical Database Design
NTW2000-T3 8A-13
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
NTW2000-T3 8A-15
Two Categories of SQL Statement
1. Data manipulation
• SELECT, INSERT, DELETE
2. Data definition
• CREATE DATABASE, DROP DATABASE
• CREATE TABLE, DROP TABLE
NTW2000-T3 8A-16
SQL Statement: INSERT
INSERT INTO table
(col1, col2, col3, ...)
VALUES (‘text1’,’text2’...,num1,..);
NTW2000-T3 8A-17
SQL Statement: DELETE
DELETE FROM table
WHERE condition;
NTW2000-T3 8A-18
SQL Statement: SELECT
SELECT column_list
FROM table
WHERE condition;
NTW2000-T3 8A-19
Use SELECT to join tables
SELECT table1.colx, table2.coly...
FROM table1, table2
WHERE condition;
NTW2000-T3 8A-20
Reference
NTW2000-T3 8A-21
NTW2000-T3 8A-22
The End
NTW2000-T3 8A-23
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/>
NTW2000-T3 8A-24
Layered Protocols: IP
Layers, interfaces, and protocols in the Internet model.
NTW2000-T3 8A-25
Layered Protocols: OSI
Layers, interfaces, and protocols in the OSI model.
2-1
TvS 2.2
NTW2000-T3 8A-26
Middleware Protocols
2-5
NTW2000-T3 8A-27
Middleware
A 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)
NTW2000-T3 8A-28
Middleware
General structure of a distributed system as middleware.
1-22
TvS 1.24
NTW2000-T3 8A-29
Middleware and Openness
1.23
NTW2000-T3 8A-30
Middleware programming models
Remote Calls
remote Procedure Calls (RPC)
distributed objects and Remote Method Invocation (RMI)
e.g. Java RMI