Matakuliah : Web Database Tahun : 2008 Web Database Transaction Session 11 Last Session Review: •Physical Database Design •Physical Web Database Design •Web Architecture •Client Processing •Server Processing •Java •Implementation Choice 2 Agenda: •Overview Transaction •Incomplete or Abandoned Transaction •Problem in Transaction •Locking and Deadlock •Web Database Transaction 3 Objectives: •Student can understand about Transaction, Incomplete or Abandoned Transaction, Problem in Transaction, Locking and Deadlock and Web Database Transaction •Student can solve problem in transaction and web database transaction 4 Overview Transaction • What is Transaction? – Sequence of instruction which alter the database so as to represent a single change in the database, and/or which retrieve information about single “snapshot” of the database to support some task • What is Transaction Management? – Ensures that each transaction satisfied certain validity properties so as to provide safeguards to the data • Validity properties: – – – – Atomicity Consistency Independence Durability 5 Incomplete or Abandoned Transaction • What is Incomplete or Abandoned Transaction? – Transaction that not completed due to failure or abandoned • Cause of Failure? – – – – Programming error Hardware trouble Network trouble etc • Cause of Abandoned? – Browser Closed – No resource to go next step (for application that use several steps) – etc 6 Problem in Transaction • Problem in Transaction? – Lost Update – Retrieval of Inconsistency Data • How solve problems? – Locking 7 Locking and Deadlock • What is Locking? – A means by which users can change parts of the database and no conflict with one another – Purpose of locks is to stop two (or more) users from trying to change the same data at the same time, and also stops one user from update data while it is being read by another user or being read while it is being updated • Levels of Locking? – – – – Tables locking Rows locking Individual objects locking Type extents locking 8 Locking and Deadlock (cont.) • Locking type that are support by commercial DBMS – Read lock – Write lock – Upgrade lock • Locking Protocols: – Two Phase Locking • Problem in Locking? – Could end up in Deadlock 9 Locking and Deadlock (cont.) • What is Deadlock? – Two or more users are attempting to lock parts of the database and a cycle occurs • How to prevent Deadlock? – Requiring each transaction to lock all the data it will needed when it starts optimistic locking – Optimistic strategy by allowing deadlock to occur and then breaks the deadlocks – Ensuring that where possible each users access a copy of required data • How to break Deadlock? – Timeouts 10 Web Database Transaction • Transaction in Web Database is more complex. • One of the complexity is how to identifying a number of request as parts of a single transaction from one user this is called “Session Tracking” • Technique to provide Session Tracking: – – – – Hidden variables URL rewriting Cookies User Authentication 11 Summary • Implementation of Web Database Application should consider the physical database design and physical web database design • There is no one solution to every problem (no-silver-bullet). There are lots of choice to implement web database application. • Choose the right implementation by regarding several considerations. 12 Next Session: •Overview Security •Database Security •Web Security •Client Security •Efficiency vs Security •Review of Session 8 - 13 13 End of Web Database Transaction Thank you 14