1 / 40

CS/SE 157B Database Management Systems II May 3 Class Meeting

CS/SE 157B Database Management Systems II May 3 Class Meeting. Department of Computer Science San Jose State University Spring 2018 Instructor: Ron Mak www.cs.sjsu.edu/~mak. Unofficial Field Trip. Computer History Museum in Mt. View http://www.computerhistory.org/

sokanon
Download Presentation

CS/SE 157B Database Management Systems II May 3 Class Meeting

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS/SE 157BDatabase Management Systems IIMay 3 Class Meeting Department of Computer ScienceSan Jose State UniversitySpring 2018Instructor: Ron Mak www.cs.sjsu.edu/~mak

  2. Unofficial Field Trip • Computer History Museum in Mt. View • http://www.computerhistory.org/ • Provide your own transportation to the museum. • Saturday, May 5, 11:30 – closing time • Special free admission. • Experience a fully restored IBM 1401 mainframe computer from the early 1960s in operation. • Do a self-guided tour of the Revolution exhibit. • 50 tickets: first come, first served.

  3. Object-Oriented Database (OODB) • An OODB is a database system based on object-oriented concepts. • OODBMS: object-oriented database management system • Combines features of • database systems • object-oriented programming languages • Addresses the limitations of traditional database systems, such as a relational systems.

  4. Applications of OOBDMS • Complex applications that require storing and manipulating objects. • Require more than typical relational operations. • Objects that don’t fit well into rows and columns. • Examples: images, maps, video • Example applications: • Multimedia • Geographical information systems (GIS) • Computer-aided design and computer-aided manufacturing (CAD/CAM)

  5. Object-Oriented Concepts • An OODB object relates to a real-world object. • Contains object attributes • Has object operations (AKA methods) • Similar objects are groups into classes. • An object is a class instance.

  6. Object Identifier (OID) • Each object of an OODB has an object identifier (OID). • System-generated. • Unique among all the objects of an OOBD,not just the objectswithin a single table. • Immutable. • Not considered to bean object attribute. Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

  7. Class Hierarchy • AKA specialization hierarchy • Similar concepts to those in an object-oriented programming language. • Classes and subclasses • Inheritance • “Is-a” relationships Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

  8. User-Defined Type (UDT) • OODB developers can define their own data types to supplement the built-in types. • Example: CREATE TYPErenter_type AS ( rentername VARCHAR(25), leasedate DATE ); CREATE TYPEindividual_typeUNDERrenter_type AS ( address VARCHAR(25), employer VARCHAR(20), ssn CHAR(9) ); CREATE TYPEcorporateclient_typeUNDERrenter_type AS ( ccindustry VARCHAR(25), cclocation VARCHAR(25) ); Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

  9. Nested Types CREATE TYPE name_type AS ( firstname VARCHAR(10), minitial CHAR(1), lastname VARCHAR (10) ); CREATE TYPE mgr_type AS ( managerid CHAR(4), mnamename_type, msalary NUMERIC(9,2) ); CREATE TYPE bldg_type_nest AS ( buildingid CHAR(3), bnooffloors INT, bmanagermgr_type );

  10. Reference Type • An object can reference (have a pointer to) another object. • Indicated by the REF keyword. • A reference is usually implemented as theunique object ID of the object being pointed to. • Example: • A nested object contains the actual value. • A reference is only the OID. CREATE TYPE bldg_type_ref AS ( buildingid CHAR(3), bnooffloors INT, bmanagerREFmgr_type)

  11. Methods of a Class • A class can define operations (methods)on its objects as functions. • Methods can also be inherited from a superclass. • Example: Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

  12. Object Query Language (OQL) • Designed by the Object Database Management Group (ODMG). • Complex, hard-to-use language. • Not fully implemented by any commercial OODBMS. • Operations: • Create classes • Insert data into objects • Update data in objects • Query objects

  13. OQL, cont’d • Object-oriented: • Relational: CREATE TYPE name_type AS ( firstname VARCHAR(10), minitial CHAR(1), lastname VARCHAR (10) ); CREATE TYPE mgr_type AS ( managerid CHAR(4), mnamename_type, msalary NUMERIC(9,2) ); CREATE TYPE bldg_type_nest AS ( buildingid CHAR(3), bnooffloors INT, bmanager REF mgr_type ); CREATE TABLE manager AS mgr_type; CREATE TABLE building AS bldg_type_nest; CREATE TABLE manager( managerid CHAR(4),mfirstname VARCHAR(10),minitial CHAR (1),mlastname VARCHAR (10)),msalary NUMERIC (9,2), PRIMARY KEY (managerid) ); CREATE TABLE building ( buildingid CHAR (3), bnooffloors INT, bmanagerid CHAR(4) PRIMARY KEY (buildingid), FOREIGN KEY (bmanagerid) REFERENCES manager(managerid) );

  14. OQL, cont’d • Query: List the building ID and thename of the manager of each building. • Relational query: • OQL query: • No WHERE clause needed since each building object points to its manager object. SELECT buildingid, mfirstname, minitial, mlastname FROM manager, building WHERE managerid = bmanagerid; SELECT buildingid, bmanager.firstname, bmanager.minitial, bmanager.lastname FROM building;

  15. Object-Relational Database (ORDB) • A relational database that contains someobject-oriented features as an extension. • More common than OODBMS. • Example: Oracle • Implements the most widely used object-oriented features. • OIDs, inheritance, user-defined data types, nested objects, reference objects, methods.

  16. ORDB, cont’d • Advantages • Convenient for users already familiar with RDBMS. • Gain the additional features of an OODBMS. • Performance penalties • Object-oriented features are implemented on top of the relational data management system. • Difficult to optimize for performance.

  17. Database Administration • Principle tasks of the database administrator (DBA): • Monitor and maintain the database system. • Secure the database against unauthorized access. • Do database backup and recovery. • Ensure database integrity. • Optimize database performance. • Develop and implement databasepolicies and standards.

  18. Monitor and Maintain • Monitor which tables are frequently used. • Denormalize tables that are often joined. • Materialize views. • Data dictionary • Metadata repository (data about data). • Names of tables, names and types of columns, primary keys, referential constraints, etc. • Example entries: Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

  19. Security • Authenticate users. • Grant and revoke access rights. • SELECT, UPDATE, ALTER, DELETE, INSERT • Maintain the authorization matrix. • Example: GRANT SELECT, UPDATE ON vendor TO alice; REVOKE UPDATE ON vendor FROM alice; Database Systems by Jukić, Vrbsky, & Nestorov Pearson 2014 ISBN 978-0-13-257567-6

  20. Security, cont’d • Role-based access control. • Example: • Use data encryption. • Encrypt passwords and sensitive data. • Provide the decryption key only to selected users. CREATE ROLE accountant; GRANT SELECT ON payroll TO accountant; GRANT accountant TO brian;

  21. Encryption Primer • Slides presented to high school teachersas an introduction to data security.

  22. Security • Sending data such as email messages to each other via the Internet …… is like sending postcardsvia the U.S. mail system. • Anyone can read the message along the way! We plan to manufacture 7 million widgets next quarter. John Jill

  23. Security, cont’d • How can we keep the nefarious Bartfrom reading confidential messages that Jill and John are sending each other? We plan to manufacture 7 million widgets next quarter. John Jill Bart

  24. The Shared Secret • Jill needs to send a message containing the confidential data 7 to John. • John and Jill can agree ahead of time to a shared secret– the number 12. • Then Jill can encrypt the data by adding 12 to the confidential data 7. • John decryptsthe data by subtracting 12. John Jill 19 Shared secret 12 Shared secret 12

  25. The Shared Secret, cont’d • Because Bart doesn’t know the shared secret 12, he won’t be able to decrypt the message and obtain the confidential data 7. 19 Shared secret 12 Shared secret 12 John Jill Bart X

  26. The Shared Secret, cont’d • But this shared secret solution has problems. • Jill and John must arrange beforehandto share the secret 12. • What if Jill doesn’t already know John? • What if Jill wants to send the confidential data to all her vice presidents at the same time? 19 Shared secret 12 Shared secret 12 John Jill How can Jill and all her recipients share a secret?

  27. Public Key Cryptography, cont’d • How can Jill and her recipients share a secret number in order to encrypt the confidential data? • A security scheme called public key cryptography was invented just for this purpose. • In this simplified introduction, let’s pretendthat multiplication is a one-way operation. • Once you’ve multiplied two numbers, say 4x5=20,you can’t recover the original numbers by dividing. • In other words, you can’t do 20÷4=5 or 20÷5=4

  28. Public Key Cryptography, cont’d • Jill chooses a private key. • Let’s suppose Jill chooses 10. • Each person to whom she wants to send confidential data also chooses a private key. • Let’s suppose John chooses 8. John Jill Private key 10 Private key 8

  29. Public Key Cryptography, cont’d • Now Jill announces a public key. • Let’s suppose the public key is 5. • Everyone can see the public key. • Including the nefarious Bart. Private key 10 Private key 8 Public key 5 John Jill Bart

  30. Public Key Cryptography, cont’d Jill’s public-private key 50 John’s public-private key 40 • Now Jill can create her public-private key. • Multiply the public key by her private key: 5x10=50. • John creates his public-private key. • Multiply the public key by his private key: 5x8=40. Private key 10 Private key 8 Public key 5 John Jill

  31. Public Key Cryptography, cont’d Jill’s public-private key 50 John’s public-private key 40 • Remember that we’re pretending that multiplication is a one-way operation. • We cannot discover Jill’s private key 10 by dividing her public-private key 50 by the public key 5. • We cannot discover John’s private key 8 by dividing his public-private key 40 by the public key 5. Private key 10 Private key 8 Public key 5 John Jill

  32. Public Key Cryptography, cont’d Jill’s public-private key 50 John’s public-private key 40 • What is the goal of all this? • To create a shared secretbetween Jill and John. • Jill multiplies John’s public-private key by her private key: 40x10=400 • John multiplies Jill’s public-private key by his private key: 50x8=400 Private key 10 Private key 8 Public key 5 John Jill

  33. Public Key Cryptography, cont’d Jill’s public-private key 50 John’s public-private key 40 • Now Jill and John have a shared secret400. • Jill can encrypt the confidential data 7 by adding the shared secret 400 to obtain 407. • John can decrypt the confidential data 7by subtracting the shared secret 400 from 407. Shared secret 400 Shared secret 400 Private key 10 Private key 8 Public key 5 407 John Jill

  34. Public Key Cryptography, cont’d • Bart can’t decrypt the 407 because he doesn’t know the shared secret 400. 407 Shared secret 400 Shared secret 400 John Jill Bart X

  35. Public Key Cryptography, cont’d • Public key encryption works with multiple recipients. • Jill needs to send confidential data to both John and his twin brother Mark. • Each picks a private key. Mark John Jill Private key 2 Private key 10 Private key 8

  36. Public Key Cryptography, cont’d • Jill announces the public key 5, and everyone generates his or her public-private key. • Jill: 5x10=50 • John: 5x8=40 • Mark: 5x2=10 Mark’s public-private key 10 John Mark Jill Private key 2 Public key 5 Jill’s public-private key 50 John’s public-private key 40 Private key 10 Private key 8

  37. Public Key Cryptography, cont’d • Jill will have a shared secret with each recipient. • Jill and John will share 400 between them, as before. • Jill and Mark will have a different shared secret. • Jill: Multiply Mark’s public-private key byher private key:10x10=100. • Mark: Multiply Jill’spublic-private key byhis private key:50x2=100 Mark’s public-private key 10 Shared secret with Jill: 100 John Mark Jill Private key 2 Public key 5 Shared secret with Mark: 100 Jill’s public-private key 50 John’s public-private key 40 Shared secret with Jill: 400 Shared secret with John: 400 Private key 8 Private key 10

  38. Public Key Cryptography, cont’d • Jill sends to each recipient. • Bart can’t decrypt the messages to recover the confidential data 7 because he doesn’t knowthe shared secrets. Shared secret with Jill: 100 107 Mark John Jill Bart Shared secret with Jill: 400 Shared secret with John: 400 407 Shared secret with Mark: 100 X

  39. Cryptography in the Real World • Of course, in the real world, we can’t use simple operations like multiplication and addition to generate keys and to encrypt data. • Multiplication and addition are not one-way operations. • Real-world encryption uses very large prime numbers and modulo arithmetic. • Not even the most powerful supercomputer can undo such operations.

  40. The Diffie-Hellman Protocol • Public key cryptography is a key exchange protocol first published by Whitfield Diffieand Martin Hellman in 1976. • It was actually invented earlier in 1970 by the British government, but it was classified. • Whenever you visit a secure website, you are using the Diffie-Hellman protocol or a variant. • A secure website has a URL that starts with https: instead of http:

More Related