Web Enabled Databases (Web-DB)
-
Upload
soumya-jyoti-bhattacharya -
Category
Documents
-
view
221 -
download
0
Transcript of Web Enabled Databases (Web-DB)
-
8/9/2019 Web Enabled Databases (Web-DB)
1/31
8A-1NTW2000-T3
Databases and the Web
An Introduction
-
8/9/2019 Web Enabled Databases (Web-DB)
2/31
8A-2NTW2000-T3
Why is Databases on the
Web Important? Databasesareestablished technology
for managing largeamounts of data
The Web isa good way to presentinformation
Separating data management from
presentation improvesefficiencyupdating
finding information
Credit: Netskills
-
8/9/2019 Web Enabled Databases (Web-DB)
3/31
8A-3NTW2000-T3
Examples of Websites
Using Databases
Organizational information services
employee directories Booking & scheduling
airlines, university coursessignup
Electronic commerce Websiteautomation
www.yahoo.com
www.webmonkey.com
-
8/9/2019 Web Enabled Databases (Web-DB)
4/31
8A-4NTW2000-T3
How to Integrate Databases
and the Web?
Databases
Integration tools
-
8/9/2019 Web Enabled Databases (Web-DB)
5/31
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
-
8/9/2019 Web Enabled Databases (Web-DB)
6/31
8A-6NTW2000-T3
Examples of RDBMS
MS Access
desktop
MySQL, mSQL mid-range
Oracle, Sybase,MS SQL Server
largeenterprise
-
8/9/2019 Web Enabled Databases (Web-DB)
7/31
8A-7NTW2000-T3
How to Integrate Databases
and the Web? Databases
MS Access
MySQL, mSQL Oracle, Sybase,MS SQL Server
Integration tools
PHP or CGI, Servlets, JSP, ASPetc.
Middleware: e.g. ColdFusionhttp://www.allaire.com/
-
8/9/2019 Web Enabled Databases (Web-DB)
8/31
8A-8NTW2000-T3
Application Interface to
Databases CGI
PerlDBI
PerlDBD (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
-
8/9/2019 Web Enabled Databases (Web-DB)
9/31
8A-9NTW2000-T3
Relational Databases
Databases that organize data into tables Each tablehas
A name
(For identification)One or more columns
(Forattributes or fields)
Rows
(Forentries or records)
-
8/9/2019 Web Enabled Databases (Web-DB)
10/31
8A-10NTW2000-T3
Relational Database Design
Logical database design
Physical database design
-
8/9/2019 Web Enabled Databases (Web-DB)
11/31
8A-11NTW2000-T3
Logical Database Design
(Entity-relationship modeling)
Identify and model theentities
Identify and model the relationshipsbetween theentities
Identify and model theattributes
Create unique identifier foreachentity
Normalize
-
8/9/2019 Web Enabled Databases (Web-DB)
12/31
8A-12NTW2000-T3
Terminology
Term Definition
Entity A thing (person, place,event,etc.) whichexists
outside of the databaseand is represented in itAttribute Describes the properties ofa particularentity
Relationship Describes theassociationsbetween two or more
entities
Normalization Prevents inefficiency by ensuring no duplicated datain multiple tables
-
8/9/2019 Web Enabled Databases (Web-DB)
13/31
8A-13NTW2000-T3
Physical Database Design
Entitiesbecome tables
Attributesbecome columns
chooseappropriate data type foreachcolumn
Unique identifiersbecome primary keys
Relationshipsare modeled as foreign keys
Foreign keys can be primary keys from othertables
-
8/9/2019 Web Enabled Databases (Web-DB)
14/31
8A-14NTW2000-T3
Structured QueryLanguage (SQL)
Standard language for working with relationaldatabases
a type of naturallanguage
Weare going to useOracle on Borg for theexamples we will do in the class/tutorialsand forassignment-4.
If you want to usesomething else, you are
free to do so. However, note that in thatcase it willbe your responsibility to solveany problems that may come up
-
8/9/2019 Web Enabled Databases (Web-DB)
15/31
8A-15NTW2000-T3
Structured QueryLanguage (SQL)
Standard language for working with relationaldatabases
A type of naturallanguage
You may not have to writeany code Thereare tools for that e.g Accessquery tool
But necessary to understand basics,asSQL is common to all nearly all the toolscovered today
-
8/9/2019 Web Enabled Databases (Web-DB)
16/31
8A-16NTW2000-T3
Two Categories of SQL Statement
1. Data manipulation
SELECT, INSERT,DELETE
2. Data definition
CREATE DATABASE,DROPDATABASE
CREATE TABLE,DROP TABLE
-
8/9/2019 Web Enabled Databases (Web-DB)
17/31
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);
-
8/9/2019 Web Enabled Databases (Web-DB)
18/31
8A-18NTW2000-T3
SQL Statement: DELETE
DELETE FROMtable
WHERE condition;
mysql> DELETE FROM employee
-> WHERE lastname=Jones;
-
8/9/2019 Web Enabled Databases (Web-DB)
19/31
8A-19NTW2000-T3
SQL Statement: SELECT
SELECT column_list
FROMtable
WHERE condition;
mysql> SELECT * from course;
mysql> SELECT description
-> FROM course-> WHERE title LIKE Using%;
-
8/9/2019 Web Enabled Databases (Web-DB)
20/31
8A-20NTW2000-T3
Use SELECT to join tables
SELECT table1.colx, table2.coly...
FROMtable1, table2
WHERE condition;
mysql> SELECT course.title, course.description,
-> teacher.name
-> FROM course, teacher
-> WHERE course.teacher_ID=teacher.teacher_ID;
-
8/9/2019 Web Enabled Databases (Web-DB)
21/31
8A-21NTW2000-T3
Reference
Programming thePerlDBIhttp://www.oreilly.com/catalog/perldbi/chapter/ch04.html
-
8/9/2019 Web Enabled Databases (Web-DB)
22/31
8A-22NTW2000-T3
-
8/9/2019 Web Enabled Databases (Web-DB)
23/31
8A-23NTW2000-T3
The EndThe EndThe End
-
8/9/2019 Web Enabled Databases (Web-DB)
24/31
8A-24NTW2000-T3
Aside: Middleware
Adapted from Introduction to Distributed Systems: Slides forCSCI3171 Lectures by E. W. Grundke
References:
[TvS] A. Tanenbaum and M. van SteenDistributed Systems: Principles and Paradigms, Prentice-Hall (2002)
[CDK] G. Coulouris, J. Dollimoreand T. KindbergDistributed System: Concepts and Design, Addison-Wesley (2001)
-
8/9/2019 Web Enabled Databases (Web-DB)
25/31
8A-25NTW2000-T3
LayeredProtocols: IPLayers, interfaces,and protocols in the Internet model.
-
8/9/2019 Web Enabled Databases (Web-DB)
26/31
8A-26NTW2000-T3
LayeredProtocols: OSILayers, interfaces,and protocols in theOSI model.
2-1
7Y6
-
8/9/2019 Web Enabled Databases (Web-DB)
27/31
8A-27NTW2000-T3
Middleware Protocols
An adapted reference model for networkedcommunication.
2-5
7Y6
-
8/9/2019 Web Enabled Databases (Web-DB)
28/31
8A-28NTW2000-T3
Middleware
A softwarelayer that
masks theheterogeneity ofsystems
providesa convenient programming abstraction
provides protocols for providing general-purpose
services to morespecific 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)
-
8/9/2019 Web Enabled Databases (Web-DB)
29/31
8A-29NTW2000-T3
MiddlewareGeneralstructure ofa distributed system as middleware.
1-22
7Y6
-
8/9/2019 Web Enabled Databases (Web-DB)
30/31
8A-30NTW2000-T3
Middleware and Openness
In an open middleware-based distributed system, the protocols
used by each middlewarelayershould be thesame,as wellas
the interfaces they offer to applications.
1.23
7Y6
-
8/9/2019 Web Enabled Databases (Web-DB)
31/31
8A-31NTW2000-T3
Middleware programming modelsRemote Calls
remoteProcedure Calls (RPC)
distributed objectsand RemoteMethod Invocation (RMI)
e.g. JavaRMI
Common Object Request Broker Architecture (CORBA)
cross-languageRMI
Other programming models remoteevent notification
remote SQL access
distributed transaction processing&'.&K End of Aside