In the following sections, you learn about the four major replication tools available to an Access developer. You also see a simple comparison demonstrating the advantages of each tool. Some of the more esoteric features are discussed later in the chapter. For now, you should just contrast and compare the basic features provided by each replication tool.
Windows 95/98 and NT 4 include the Briefcase as an easy-to-use tool that allows you to work on files at home or on the road, and keep the various copies of the files synchronized (see Figure 23.1). Because an Access database is inherently a potential multiuser database, you must now ensure that any changes you make while at home or on the road can be merged with changes made by your colleagues at the office. After you install Access 2000, a database file placed into the Briefcase is automatically converted into a replicated database. Now simultaneous updates can occur at each copy and be merged at a later date.
The Briefcase is best suited to ad hoc replica usage. For example, imagine you're working on a multiuser customer contacts database that's being shared with your co-workers on a network. You want to take a copy of the database with you on a business trip, so you open Explorer and drag a copy of the database into your Briefcase on your laptop computer. You modify the data while away from the office, and on your return you merge your updates with the replica of the database on the network.
Let's go through an example of creating a database and using the Briefcase to replicate the database, and then merge the replicas:
1. |
Ensure that the Briefcase is visible on your Windows 95/98 desktop. (If it isn't, right-click the desktop and choose New and then Briefcase.) |
2. |
In Access, create a simple database called Db1.mdb, with one table and one field, and add a couple of records. Close Access and open the Windows Explorer. Drag Db1.mdb into the Briefcase, answering Yes to the prompts. Click OK (the default) when asked which copy should be allowed to make design changes. This results in the original database being allowed to make the design changes. |
3. |
Open the Briefcase by double-clicking the Briefcase icon. Open the database by double-clicking Db1.mdb in the Briefcase. Add one or two records, and then close the database. |
4. | |
5. |
Open the Briefcase, highlight Db1.mdb, and choose Update Selection from the Briefcase menu. You should be notified that the Briefcase and original copies of the database have been modified, and the Merge icon (two green arrows pointing to each other) should be displayed. Click the Update button; you see an animated icon as the merge takes place. |
If you now open either replica in the Briefcase or in Explorer, you'll see the updates from each have been merged. The default action is for the Briefcase to simply create a DOS copy of the file on the network.
Note
Microsoft Access is the first product that provides a significant increase in functionality over the non-Briefcase-aware application. The Access Briefcase Reconciler is an Access Setup option that loads and registers an Access-specific DLL used for Windows 95/98, ensuring that changes are merged and not lost.
Products that don't provide specific support for the Briefcase use the default Briefcase Update action, which overwrites the original file with the changed file. If the Briefcase and networked copies have been modified, the user is prompted to choose the network copy or the Briefcase copy. When the user chooses a copy, the updates made to that copy become permanent; the updates in the other file are lost.
Creating and synchronizing replicated databases by using the Briefcase is extremely powerful and easy to do. As you'll see, however, greater functionality is possible when you use the Access menus, Replication Manager, and Jet and Replication Objects (JRO), an ADO component.
The Access Tools menu has a choice for replication (see Figure 23.2). This submenu provides all the functionality required by most users: a database may be converted into a replicable database; additional replicas, including partial replicas, can be created with the Partial Replica Wizard; replicas can be synchronized; and conflicts can be resolved.
Let's repeat the example from the preceding section, which described how to use the Briefcase—this time, however, use the Access menu commands. Follow these steps:
1. |
In Access, create a simple database named Db2.mdb, with one table and one field, and add a couple of records. |
2. | |
3. |
Add one or two records to the table in Db2.mdb, and then close the database. |
4. |
Open Replica of db2.mdb and add another couple of records. Now you should have two replicas of Db2.mdb, with different records added to each. |
5. |
If you now open Db2.mdb or Replica of db2.mdb, you'll see that the updates from each have been merged. Also notice that when you open Db2.mdb, its title bar has been modified to read db2.mdb : Design Master. Similarly, when you open Replica of db2.mdb, its title bar reads db2.mdb : Replica.
Note
The other three Replication submenu options, Partial Replica Wizard, Recover Design Master, and Resolve Conflicts, are discussed later in the sections “Partial Replicas,” “Recovering the Design Master,” and “Using the Access Conflict Resolver.”
The Replication Manager utility, which ships with the Microsoft Office Developer (MOD) tools, is a sophisticated tool for managing distributed replicated databases (see Figure 23.3). Replication Manager is generally used only by database systems administrators.
The Replication Manager allows mobile laptop users to specify a shared network location where scheduled exchanges from a remote replica can deposit updates for later collection.
Beyond those provided by Access, the four most significant additional features in the Replication Manager are
Configuration for synchronization of replicas over the Internet
Configuration support for mobile laptop users
Scheduling the synchronization of replicas
Graphical topology of distributed replicas
Also, synchronization histories, reports, and various property sheets provide the information required to manage sophisticated replicated applications. A detailed synchronization log provides valuable information when troubleshooting distributed applications.
A solid line joining two sites—for example, Redmond and Paris—indicates that a synchronization is scheduled between them. To view and edit the schedule, simply double-click the line.
In any application that supports ADO, Jet and Replication Objects (JRO), referred to as JRO through the remainder of the chapter, provides a programmatic interface to replication functionality in Microsoft Jet databases. You can use methods and properties within JRO to convert a database into a replicable database, create additional replicas, synchronize replicas, and manage certain properties within a replicated database.
The new features in Microsoft Jet 4.0 replication are exposed only in JRO programming, not in DAO programming. They include setting a replica's priority, executing an indirect synchronization in code, setting a replica's visibility, and much more. To use JRO, choose References and then Microsoft Jet and Replications Objects Library from the Tools menu in the VBE in Access.
3.141.27.244