L AB F OR LU13 – D ISTRIBUTED D ATABASES AND DDBMS O VERVIEW In this lab, we will reinforce the principles of distributed data management through two separate parts. In the first part, we will create a database by distributing database objects using two separate database management systems: Microsoft Access and Microsoft SQL Server. When database objects are placed in two or more locations under the control of two or more different DBMS’, we create a heterogeneous distributed database system. Users can then access the database with without being concerned about where the various database objects reside. In the second part we will explore database replication and the issues associated with it. Again using Microsoft Access we will create a database and a replica and synchronize data between the two databases. Through the exercise you’ll discover that while replication is a useful tool for distributing data, it can be costly to execute at near-real time. L EARNING O BJECTIVES Upon completion of this learning unit you should be able to: Describe various Distributed DBMS implementations Explain how database design affects the DDBMS environment Apply Distributed DBMS principles to solve problems L AB G OALS This lab consists of 2 parts: 1. In the first part you will create a heterogeneous distributed database system using Microsoft Access and Microsoft SQL Server. 2. In the second part you will create a homogeneous distributed database system that uses replication to distribute the data. You will have to hand in pieces from parts 1 and 2 on this week’s learning assessment. W HAT YOU WILL NEED TO BEGIN 1. The information to connect to your SQL Server Instance, and a network connection that permits you to connect to the server. 2. A copy of Microsoft Access 2000 (or higher) P ART 1: F UDGEMART : D ISTRIBUTED S TYLE ! In this part you will create a database application in Microsoft Access which uses data from your SQL Server instance. This will be a heterogeneous database. Page 1 S ETUP THE DATABASE PR OJECT Create a new project in Microsoft Access. Access Data projects are different from Access Databases in that the back-end data is in SQL Server. This creates a two-tier client/server model and a distributed database with location transparency. 1. Open up Microsoft Access from the start menu. From the Office menu, select New. Then click on [Blank Database] 2. Click on the folder icon near the filename to browse for the file destination folder 3. Select your folder then click on [SAVE AS TYPE] drop down option Select the [Microsoft Access Projects *.adp] option. Then type a filename (no need to indicate extension). Notice the name and the extension adp. Click on create. Page 2 4. You will be asked Select Yes 5. Complete the details using the sample below. Be sure to check this Make sure this is your database Test your connection before clicking OK 6. Enter your connection information and then click OK. You will receive some security warning messages. Just accept them and click ok. The database window should appear displaying the objects from your database database. Double click on a table to see its contents. Page 3 C REATE THE F UDGEMART E MPLOYEES F ORM 1. To create a form highlight the table (fudgemart_employees) and click on FORM, you should see this: 2. 3. 4. To change item on the form we have to switch to design view by clicking on By default ALL fields are select, click outside of the form to avoid modifying multiple items at once. Right click on employee_jobtitle and select properties. The property sheet pane should come up. Page 4 5. Make another right click on employee_jobtitle. Select [Change to] Combo Box. 6. Make the following change in the combo box properties: row source = dbo.fudgemart_jobtitles_lookup 7. Close the property sheet. 8. Switch back to Form view by clicking consistency :-) . Notice the now employee_jobtitle is a drop down bow. Better for data Page 5 9. Next, let’s modify the drop-down lookup for department On your own, attempt to repeat the process for employee_department. First change to a combo box, then set the Row source property to dbo.fudgemart_departments_lookup 10. And finally, lock the edit of employee_total_hours. Bring up the properties for employee_total_hours and set Locked = yes and Special Effect = Flat N OW L ET ’ S ADD A M ASTER -D ETAIL FORMVIEW . Next we will add a sub-form to the project to display the timesheets for each user on the form. 1. Let's create a master/details form. 2. Highlight the fudgemart_employees table. Click on 3. Right click on the tab with name and select save. 4. Type de name of the master form and click OK. 5. Highlight fudgemart_employee_timesheets. Click on more forms and select datasheet. . Page 6 6. Right click on the tab with name and select save. 7. Type the name for the form. Click OK 8. Make a right click and close the form. 9. Make sure that the form fudgemart_employees_master_details is open. Switch to design view by clicking on 10. By default ALL fields are select, click outside of the form to avoid modifying multiple items at once. 11. Resize header and footer. 12. Resize header and footer. 13. Click on subform / subreport Page 7 14. Draw a rectangle after the last field. This box will come up. 15. Click on existing form and select fudgemart_employee_timesheets. Click on next. 16. Establish the relationship. Then click on finish. 17. Click on the upper most left save button to save the form. 18. Switch back to Form view by clicking . Page 8 19. Click on the record navigation buttons to advance to the next employee. Notice how the subform updates accordingly. P ART ONE 1. 2. 3. 4. 5. L AB Q UESTIONS What facets of this database make it a distributed database? Explain how this database illustrates location transparency? What aspects of the database make it heterogeneous? What aspects of the database make it single site data? What aspects of the database make it multi-site processing? P ART 2: F UDGEMART : D ISTRIBUTED S TYLE ! In this second part we will explore how database replication works using Microsoft access. Like most modern DBMSes Microsoft Access has a data replication engine included to assist with the process. As you know by now, I like funny names, like Kent Belevit and Sal Ladd. The trouble is coming up with all these funny names are hard work. Good thing the other database instructors Dave and Susan Dischiave have agreed to help me. In this lab you will design a master Microsoft access database and three replicas so that Dave, Susan, and myself can quazi-simultaneously add funny names at our leisure in our own copies of the database, and then “synch them up” with the master database as needed. S ETUP THE DATABASE Page 9 1. First, let’s create the funnynames file. Open Microsoft access. From the menu, select file new. Choose blank database and name the database funnyname. 2. Let’s create the uber-simplistic FunnyNames table. Next, click on Design View. 3. Save the table. Use FunnyNames as name. 4. Change the data type and field name. Check the primary key button. 5. Close the table. 6. Double-click on the table an add some names: Close the table after you’ve added these three names. N OW , ITS TIME TO CREATE THE 3 REPLICAS Next, let’s create the three replica databases for Carlos, Mike and Susan: 1. Create another blank database, name it Susan. 2. Click on the menu for external data. Select Access. Click on Link to the data source ... 3. Select the previous database funnynames. Select the table you want to link. Close the database and repeat the process for Mike and Carlos. Page 10 4. Close Microsoft access and the master (funnynames) database for now. P LAYING WITH REPLICAT ION Now it is time to put on the Mike, Dave and Susan hats and add some names to our database. 1. Open all three databases for Mike, Carlos, and Susan respectively. This will mean you’re running three instances of Microsoft Access on your computer. 2. In the Mike database add the following names to the table: Mary Mi and Seymour Ofu, for example: Close the FunnyNames table when you’re done. 3. Switch over to the Dave database open the table and add the following names: Alma Firenzergon, Willie Survive, and Mary Mi. What happens? 4. Finally switch to the Susan database, open the table and add these names: Pat Acake, Sara Bellum, Skip Peah, Willie Survive (Yes, Again, I know willie is a conflict) Something like this: 5. What happens? 6. If you look at the table databases in any of the three databases: Mike, Dave, or Susan ,is the data the same? P ART TWO 1. 2. 3. 4. 5. L AB Q UESTIONS What facets of this (in part 2) database make it a distributed database? Explain how this database illustrates location transparency? Is this database homogeneous or heterogeneous? Explain? Is this database single site data or multi site data? Explain? What type of replication does this use? Push or Pull? When a change is made on a replica then the master is notified how are the other replicas notified? Page 11