Understanding Networked Applications: A First Course Chapter 15 by David G. Messerschmitt Understanding Networked Applications: A First Course Databases by David G. Messerschmitt Databases • Treat data as a separate asset – May be shared by multiple applications • Provide protection and integrity features appropriate to mission-critical data – – – – Access control Integrity constraints Persistence etc. Understanding Networked Applications 3 A First Course Two capabilities Application I Aggregation: accessing multiple databases Application II Sharing: two or more applications accessing the same databases Databases Understanding Networked Applications 4 A First Course Relational table Table Employee Name Address Dept Record Field Understanding Networked Applications 5 A First Course Database operations Employees Departments Each operation results in a new table, so they can be concatenated “PROJECT” “SELECT” Understanding Networked Applications 6 A First Course Multiple tables “PROJECT” Understanding Networked Applications “SELECT” 7 A First Course Record at a time processing Database Application logic (system programming language) SQL Understanding Networked Applications 8 A First Course SQL interface • Presents single abstract interface to the application logic • Standardized, not vendor specific – “Stored procedures” and “extensions” violate this • Encapsulates various internal details – – – – Data partitioning and replication Host mapping File representation etc. Understanding Networked Applications 9 A First Course Fields, columns, attributes Records, rows Year 2002 2002 2002 2002 2002 2002 2002 2002 2002 2003 2003 2003 2003 2003 2003 2003 2003 2003 City Oakley Oakley Oakland Oakland Berkeley Berkeley Berkeley Albany Albany Oakley Oakley Oakland Oakland Berkeley Berkeley Berkeley Albany Albany Accommodation Bed&Breakfast Resort Bed&Breakfast Resort Camping Bed&Breakfast Resort Camping Bed&Breakfast Bed&Breakfast Resort Bed&Breakfast Resort Camping Bed&Breakfast Resort Camping Bed&Breakfast Understanding Networked Applications Tourists 14 190 340 230 120000 3450 390800 8790 3240 55 320 280 210 115800 4560 419000 7650 6750 10 • Entries are simple data types or compositions of those types • Integrity constraints A First Course Object/table correspondence Class Class implementation Record-at-a-time program Employee Name Address Dept Object instance data Attribute Understanding Networked Applications 11 A First Course Object attributes Object instances Year 2002 2002 2002 2002 2002 2002 2002 2002 2002 2003 2003 2003 2003 2003 2003 2003 2003 2003 City Oakley Oakley Oakland Oakland Berkeley Berkeley Berkeley Albany Albany Oakley Oakley Oakland Oakland Berkeley Berkeley Berkeley Albany Albany Accommodation Bed&Breakfast Resort Bed&Breakfast Resort Camping Bed&Breakfast Resort Camping Bed&Breakfast Bed&Breakfast Resort Bed&Breakfast Resort Camping Bed&Breakfast Resort Camping Bed&Breakfast Understanding Networked Applications Tourists 14 190 340 230 120000 3450 390800 8790 3240 55 320 280 210 115800 4560 419000 7650 6750 12 • Rows can be considered object instances with the same attributes • Restriction to simple data types • No encapsulated state • No methods A First Course Object-relational database • A column can store object instances of a given class rather than data of a given simple or compound data type • Because of the table structure, SQL can be extended to this case • Standard SQL queries can be extended to methods returning simple data types • Many other good ideas Understanding Networked Applications 13 A First Course Benefits of ORDBMS • Extension: manage arbitrarily complex data types • Migration: preserve and extend existing databases • Preserve SQL interface – OR extensions in latest standard • All the benefits/experience of earlier databases – Access control, data integrity, persistence, etc. • Killer app: Behind Web/CGI – Images, video, audio, animation, applets, etc. Understanding Networked Applications 14 A First Course Understanding Networked Applications: A First Course Markup languages by David G. Messerschmitt Definition • A markup language describes the structure of a document – Based on tags – Tags denote structural elements like sections, subsections, figures, etc • Internationally standardized, so application independent Understanding Networked Applications 16 A First Course Example: HTML HEAD> <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Win"> <TITLE>David G. Messerschmitt Homepage</TITLE> </HEAD> <BODY ALINK="#c4124e" BACKGROUND="Images/background.jpg"> <H3>&nbsp;</H3> <BLOCKQUOTE> <H2><TABLE BORDER="5" CELLSPACING="2" CELLPADDING="0"> <TR> <TH> <P ALIGN=LEFT><IMG SRC="Images/Messer.gif" WIDTH="112" HEIGHT="168" ALIGN= "BOTTOM" NATURALSIZEFLAG="3"></TH></TR> </TABLE> </H2> <H2><BR> David G Messerschmitt</H2> <H3>Roger A. Strauch Professor of <A HREF="http://www.eecs.berkeley.edu/">Electrical Engineering and Computer Sciences</A></H3> Understanding Networked Applications 17 A First Course Family lineage SGML XML HTML Emphasizes formatting and presentation of documents Emphasizes structure of documents Understanding Networked Applications 18 Purpose- and industry-specific extensions A First Course Data sharing among applications • Options include: – – – – Messages with defined formats Documents (eg. XML) Shared databases Remote method invocation middleware • The first two are the most practical for interenterprise applications Understanding Networked Applications 19 A First Course