330 likes | 426 Views
Databases. CIS 422. Lifetime of Data. Transient results to the evaluations of expression Variables involved in procedure activation Global variables Dynamically allocated variables Data that exists between executions Data that exits between versions Data that outlives a program.
E N D
Databases CIS 422
Lifetime of Data • Transient results to the evaluations of expression • Variables involved in procedure activation • Global variables • Dynamically allocated variables • Data that exists between executions • Data that exits between versions • Data that outlives a program
Essentials to Provide Persistence • Object ID • Properties and relationships • Scale of the store • Stability of the store
Marketing Database Engineering DBMS Sales Accounts Employee Inventory Customer Parts Accounting Engineering Parts Customer Marketing Inventory Accounting Accounts Database vs File System
Database • A collection of related data • Represents some aspect of the real world • Is a logically coherent collection of data with some inherent meaning • Is designed, built, and populated with data for a specific purpose.
Database Management Systems • Data • Schema • Program Independence • Views
Motor Vehicle Bus Truck Car Hierarchical Model
Customer Soup Order Network Model
Soup-ID Soup Name Price Address Cust-ID Cust-ID Order-ID Name Soup-ID Phone Qty Relational Model
Database Interface • Approaches • Data Definition Language CREATE TABLE inventory (inventory-number CHAR(20)NOT NULL description CHAR(25)NOT NULL price DECIMAL (9,2) • Data Manipulation Language
Shareability • Transactions • Commit • Abort • Atomicity
Concurrency • Locking • Conservative Locking Policy • Read Locks • Write Locks
Object Oriented vs Traditional • Objects are active components • OO Databases have inheritance • Allow storage in the form of objects
OODBMS - OO Part • The system must support complex objects • Object identity must be supported • Objects must be encapsulated • The system must support types or classes • The system must support inheritance • The system must avoid premature binding • The system will be computationally complete • The system must be extensible
OODBMS - DB Part • It must be persistent, able to remember object state • It must be able to manage very large databases • It must accept concurrent users • It must be able to recover from hardware and software failures • Data query must be simple
OID OID OID Emp# Position Salary Emps ENAME DEPT# Mgr Budget DNAME ddd sss eee Mktg Smith 50,000 E001 1,000,000 D01 …... Complex Objects Job Object OID’s of Employee Objects
Object Data Management GroupModel Parts • Literals • Objects (OID) • system assigned • not dependent on attribute values • conceptual address • Collections
Abstract Types - Interfaces • Inherit signatures of operations • Noninstantiable • Behaviour Inheritance • Supertype must be an interface • Subtype may be interface or class
Classes • Specifies both attributes and behavior • Instantiable • Class Inheritance • supertype must be a class • subtype must be a class
Relationships • Inverses • 1-1 • n-1 • n-m
Persistent Objects • Naming & Extents • Reachablility • Key
Worker calcDeductions calcPay Employee string name string ssn int dependents Salaried double salary Hourly double hours double rate Company Schema 1 1 n 1 office department
Representation interface Worker { method double calcDeductions(); method double calcpay(); }; class Employee : Worker ( extent workers key ssn) { atttribute string name attribute string ssn attribute int dependents relationship Department worksIn inverse Department::hasEmployees relationship Office residesAt inverse Office::houses }
Representation Continued class Salaried extends Employee ( extent salaried) { attribute double salary } class Department ( extent departments key number) { attribute int number attribute string name relationshipset<Employee> hasEmployees inverse Employee::worksIn }
car cost color make model Cost color make model Table-Class Mapping
Employee Customer name address custID empID name address empID name address custID Table-Multiple Classes Mapping
HourlyEmp wage Employee name ssn address SalariedEmp salary name address ssn wage salary Table-Inheritance Classes Mapping
Name DepartmentID Name deparmentID ssn salary Department name departmentID Employee name salary ssn Instance Relationships
Client • Sends message to server • Manages user interface • validate data • dispatch requests • Solution specific logic • GUI
Server • Fulfills the client request • Usually does database access functions • File server • Transaction server • Located separate from client
Basic Characteristicsof Client-Server Apps • Front-end client acts with back-end server • The two tasks have fundamentally different needs • Environment is generally heterogeneous and multivendor • Scalability
Common Components • User Interface • Business Processing • Database Processing
Distributed Processing • Processing divided up between processes • Objects can be distributed and accessed by users across a network