Matakuliah : Web Database Tahun : 2008 Web Database Implementation Session 8, 9 and 10 Last Session Review: •Complication in Web Database •Limitation in Web Database Method •Web Database Design Method •Web Data Analysis •Logical Web Data Design •Physical Web Database Design 2 Agenda: •Physical Database Design •Physical Web Database Design •Web Architecture •Client Processing •Server Processing •Java •Implementation Choice 3 Objectives: •Student can implement Physical Database Design, and Physical Web Database Design •Student can choose the suitable Web Architecture for the web database application •Student can choose to implement Client Processing or Server Processing or combination •Student can use Java Technology 4 Physical Database Design • What is Physical Database Design? – The process of producing a description of the implementation of the database on secondary storage; it describes the base relations, file organizations, and indexes used to achieve efficient access to the data, and any associated integrity contraints and security measures. • Property to select physical representations? – speed – capacity – Resilient to catastrophes • Implementation of physical Database Design highly depend on the DBMS, thats why it is important to choose DBMS according to physical database implementation needs 5 Physical Database Design (cont.) • Consideration when implement Physical Database Design? – – – – – Logical Database Design Quantities and volatility of data The ways in which the data is to be used Transaction properties Cost • After choosing DBMS for Physical Database Design, ERD Normal can be implemented according to DBMS • Steps of the physical database design methodology? – Translate logical data model for target DBMS: involve the design of the ERD Normal and general contraints using the available functionality of the target DMBS – Design file organizations and indexes: choosing the file organizations and indexes for the base relations – Design User View: deciding how each user view should be implemented 6 Physical Database Design (cont.) • Translate logical data model for target DBMS – Design Entities, Relations, Attributes from ERD Normal • • • • Name the entities (tables) and attributes Add primary keys, alternate keys (if needed), and foreign keys (if needed) Add Referential integrity For each attributes: – – – – Decides its domain Decides optional default value Decides whether the attribute can hold nulls Decides whether the attribute is derived and if so how it should be computed – Design representation of derived data • Decides whether data should be stored in database or calculate every time it is needed. • Consideration: – Additional cost to store and keep it consistent – Cost to calculate it 7 Physical Database Design (cont.) • Translate logical data model for target DBMS – Design General Constraints • Integrity constraints: required data, domain constraints and entity adn referential integrity • Design of constraints depend on the DBMS 8 Physical Database Design (cont.) • Design file organizations and indexes – Objective: • Determine the optimal file organizations to store the database and its indexes that are required to achieve accetable performance – Type of file depend to DBMS – Activities in Design File Organization and Indexes: • Analyze Transaction: to understand the functionality of the transaction that will run on the database and to analyze the important transaction • Choose File Organizations: to determine an efficient file organization for each database • Choose Indexes: to determine whether adding indexes will improce the performance of the system • Estimate Disk Space Requirements: to estimate the amount of disk space that will be required by the database 9 Physical Database Design (cont.) • Design file organizations and indexes – File Organizations Technology • • • • • Heap Files Hash Files Indexed Sequential Office Acess Method (ISAM) B*-Tree Clusters – Indexes Technology • Multi-level Indexes • Indexed Sequential Access Method 10 Physical Database Design (cont.) • Design User View – To design the user view that were identified during the requirements collection and analysis stage – Can be implemented using Views 11 Physical Database Design (cont.) • Case Study Physical Database Design: A relational table is designed to represent details of projects. Its columns are project number, employee number of project leader, project name, host department and head of host department. Each project has a unique number, a leader and a host department. Each department has only one head, but can host many projects. Make the necessary implementation physical database planning and all scripts for this case. 12 Physical Web Database Design • What is Physical Web Database Design? – Designs how the Web pages are to be implemented and connected to the database system – Software tools and techniques that can be used to make a database system accessible via the web • Database system component may be implemented as extensions to the servers or browsers, or may be external to the web • Implementation should analyze and decide how to access the database from the client or server and at which of these to process the application • Implementation should also consider the web architecture 13 Web Architecture • Web applications should be build in client server architecture • Client server architecture type: – Two-Tier Client Server Architecture – Three-Tier Client Server Architecture 14 Web Architecture • Two Tier Client Server Architecture 15 Web Architecture (cont.) • Three Tier Client Server Architecture 16 Web Architecture (cont.) • Advantages Three Tier Client Server Architecture: – – – – – “Thin” client, requiring less expensive hardware Application maintenance centralized Easier to modify or replacing one tier without effecting others Separating business logic from database function Maps quite naturally to web environment 17 Client Side Processing • What is Client Side Processing? – Client side processing=client side scripting – Approach that enable application executed by the Web client system rather then the server – Basically client side processing suitable for small-scaled functionality, such as web pages animations, and simple data validation and calculation. – Could avoid a number of possibility slow connection. – Client should have minimal resources to process the information – Common language used in Client Side Processing: Java (Java Applet or JavaScript) 18 Client Side Processing (cont.) • Two basic approaches to client side processing: – Browser Extension • The browser is extended to give additional functionality • By using plug-ins (in Netscape or Internet Explorer), ActiveX Control (Internet Explorer) or using Java Applets and JavaScript • How to create Browser Extension: – Script Language Interpreters, e.g. JavaScript – Bytecode Interpreter, to implement the Java Virtual Machine (JVM) to interpret Java – Access to Operating System Resources 19 Client Side Processing (cont.) • Two basic approaches to client side processing: – External Application • Existing database clients on the client system, and are launched by the web browser to provide additional services or other application such as legacy system cover by middleware • Similar to using a server site gateway to execute other systems • Advantage: – Can interact directly with the DBMS using its database transaction management system • Disadvantage: – Interaction between the client and server are not controlled by the DBMS transaction Management 20 Client Side Processing (cont.) • Advantages of Client Server Processing: – Distribution of processing – Speed of feedback – Added Web-page functionality • Disadvantages of Client Server Processing: – – – – Environment Dependencies Security Download Time Programming Limitation 21 Client Side Processing (cont.) • Case Study Client Side Processing An organization want to make website that has fast response and attractive with many dynamic content. Is Client Side Processing is the right choice to make this kind of website? Please explain. 22 Server Side Processing • What is Server Side Processing? – Approach that enable application to do processing in server rather then in client • Procedures in Server Side Processing? – Data must be sent from a client to a server – The data must be processed on the server – Result must be sent from the server to client • Two Different Approach of Service Side Processing: – HTML Preprocessors, such as Active Server Pages (ASP) and Java Server Pages (JSP), known as Server Side Scripting – CGI Scripts, maybe written in different language • What ever techniques used, there must be a method of making a database connection from that language 23 Server Side Processing (cont.) • Server Side Scripting – What is Server Side Scripting? • • • • Program is embedded in HTML Web page contains instructions that are executed Pre-processing system from HTML Directive can be embedded into Web pages, and are then processed by the server when the pages are delivered to a user. The Web server processes these pages and dynamically produces an HTML documents that is sent to the browsers. • Allow fragment if code inserted into HTML or its variants – Advantages: • Lots of different and competing technology that can be implemented – Disadvantages: • No truly cross platform scripting language • More difficult to compile • Specific server may determine the choice of pre-processor 24 Server Side Processing (cont.) • Server Side Scripting – Server Side Scripting Languages: • • • • • • • • ASP (Active Server Pages) ASP.Net JSP (Java Server Pages) PHP Server Side Java Scripts SSI (server Side Include) Cold Fusion Etc. 25 Server Side Processing (cont.) • CGI (Common Gateway Interface) – What is CGI? • HTML embedded in program. A program is execute to create HTML • An interface by which executable programs can be created to execute on the server, and which are separated from the HTML Web Pages • Can be written in many languages – CGI Disadvantages: • Efficiency • Security • Identity – CGI Languages: • Perl • Ingres-Ice • O2-O2Web 26 Server Side Processing (cont.) • Case Study Server Side Processing An organization want to make website that has fast response and attractive with many dynamic content. Can we use Server Side Processing for this case? Please explain and give the possible constraints if we use Server Side Processing. 27 Java • What is Java? – Programming language for implemetation processing in Web Database system, can be use in Client side processing or Server Side Processing – In Client Side Processing Java Applets, JavaScript – In Server Side Processing (Server Side Scripting and CGI) Java Servers Pages (JSP), Java Servlets or Java CGI • Advantages of JAVA: – The programming language it self – Java Virtual Machine (JVM) – Library of classes and interfaces 28 Java (cont.) • How will Java be Used? – – – – To Access Database JDBC To implement Java in Client Side Processing Java Applet To implement Java in Server Side Processing Java Servlets To implement Java in CGI Java CGI 29 Implementation Choice • How to Choose between Client Side Processing or Server Side Processing? – Consideration: • • • • • Distributed System Workload and Speed Scale of Functionality Sufficient Resources in Server and Client Dependent Consideration Client Side Server Side Distributed System Distribute function to clients Centralize function in Server Workload and Speed Give fast feedback Slower feedback, depend on the Network and Server Workload Scale of Functionality Small-Scale Functionality Large-Scale Functionality Sufficient Resource Client should have sufficient Resources Server should have sufficient Resources Dependent Depend to Client Environments Independent to Client Environment 30 Implementation Choice (cont.) • How to Choose between Languages? – Consideration: • • • • • • • Client Processing Appearance Database Detection and Validation Graceful Degradation Browser Detection Feature Bloat User Interface Issue – User Interface and Web – User Interface and Intranet – User Interface and Control 31 Implementation Choice (cont.) • Case Study Implementation Choice The director of an e-commerce company reqiores advice on whether to adopt Java or JavaScript for implementation. One consideration is that the appearance of Web pages is very important. As is the widest possible distribution to Web users. Write a short report weighing out the pros and cons 32 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. 33 Next Session: •Overview Transaction •Incomplete or Abandoned Transaction •Problem in Transaction •Locking and Deadlock •Web Database Transaction 34 End of Web Database Implementation Thank you 35