There are many reasons for working with offline data. Here are two common ones:
- You are a salesperson who is traveling and meeting customers. Before you travel, you want to review the latest sales orders and marketing trends of the customers you are visiting. This information is stored in your company's orders and customers databases. You download data about these customers to your laptop computer. While visiting these customers, you update the downloaded customer information such as phone numbers, e-mail addresses, and personnel contacts on your laptop. You also enter new orders on the laptop, but you want to fulfill these orders as quickly as possible. At the end of the day, you connect to your company's internet though a secure dial-up connection and update the orders and customers databases. Data conflicts are automatically reconciled in the orders and customers databases based on established business procedures. Then you print and fax a confirmation report for the customer to read, or e-mail a report snapshot that the customer displays using Snapshot Viewer.
- You are a software developer and you want to finish up working on your company's bug tracking application at home where you don't have convenient or secure access to your corporation intranet. You take offline only the bugs assigned to you on your laptop computer. You undock your laptop computer, go home, and then change status fields, update assignments, and so on at home. The next day, you dock your laptop computer and easily synchronize the changes with your company's bug tracking application.
System requirements for using offline data
You need the following software to create an use offline data:
- Microsoft Access 2002 or later installed on a client computer, such as a laptop or home computer.
- Microsoft SQL Server 2000 Desktop Edition installed and running on a client computer.
- Microsoft SQL Server 2000 installed and running on a remote server.
- Microsoft Internet Explorer 5.01 with Service Pack 2 (SP2) or later installed on the client computer and remote server.
Creating and using an offline data application
The general process of creating and using an offline data application works like this:
A developer creates a Web-based database application using one or more data access pages
In a Microsoft Access Project connected to a Microsoft SQL Server 2000 database on the remote server, a developer creates one or more data access pages that access the data the user wants to take offline. A developer needs to set the following Microsoft Office Data Source Component (MSODSC) properties to configure the Page for offline use:
OfflinePublication
OfflineCDF
OfflineType
OfflineSource
For more information on using these MSODSC properties, press F1 in the Page property sheet on the property field.
If the offline application uses two or more Pages, or a Page contains additional images and controls, then a developer needs to create a Channel Definition Format (CDF) file and link the CDF file to the Page using the OfflineCDF property. Internet Explorer reads this CDF file to download all pages and HTML-related files.
The following examples shows a sample CDF file and a LINK element HTML tag added to the Page:
--applicationfilename.cdf
<?XML VERSION="1.0" ENCODING="windows-1252"?>
<CHANNEL HREF="default.htm"
PRECACHE="YES"
LEVEL="0">
<ITEM HREF="Products.htm"></ITEM>
<ITEM HREF="Categories.htm"></ITEM>
<ITEM HREF="CategoryDetail.htm"></ITEM>
<ITEM HREF="Orders.htm"></ITEM>
<ITEM HREF="OrderDetails.htm"></ITEM>
<ITEM HREF="xmldata\Categories.XML"></ITEM>
<ITEM HREF="bitmaps\CorpLogo.gif"></ITEM>
<ITEM HREF="bitmaps\ShippedItem.gif"></ITEM>
<ITEM HREF="bitmaps\BackorderedItem.gif"></ITEM>
<ITEM HREF="bitmaps\Discontinued.gif"></ITEM>
</CHANNEL>
--HTML tag in data access page
<link rel = “offline” href = “applicationfilename.cdf”>
For more information on CDF, see the Microsoft Developer Network (MSDN) Web site.
A database administrator defines replication on the remote SQL Server 2000 database
A database administrator uses SQL Server 2000 to define replication on the remote SQL Server 2000 database, and create a single, named merge publication. SQL Server has a Publication Wizard which makes it easy to create a publication. The SQL Server Desktop Engine installed and running on the local computer is defined as the location of the local subscription database.
To handle potential data conflicts when the offline data is brought back online by a user, a database administrator must also define merge replication rules in the named, merge publication. This named publication can reference any database objects.
Caution It is important to define server filter restrictions in the publication to reduce the potential large amounts of data moved to the client (which, by default, is all data from all tables).
For more information on SQL Server replication, the Publication Wizard, and merge publications, see the SQL Server documentation.
A user takes the data offline
When a user is viewing a Page in Microsoft Internet Explorer or in Page view of Access, and takes the data offline:
- Internet Explorer will automatically download to the user's computer the Access project, the Page, and, if a CDF file is defined, all other Pages and HTML-related files defined.
- SQL Server does a merge synchronization that creates a snapshot of the data in the remote SQL Server database based on the named, merge publication and downloads this data snapshot to SQL Server 2000 Desktop Edition running on the user's computer.
A user works with the offline data
A user disconnects the computer from the intranet, and then reads and updates the data on the local computer. While working offline, the connection to the Access project is automatically pointed to the local subscription database instead of the remote server database.
A user brings the offline data back online
A user reconnects a client computer to the corporate intranet and synchronizes the Page or Pages. The Access project is automatically pointed to the remote server database, instead of the local subscription database. SQL Server merges and updates the offline data (including any schema changes) from the local computer to the remote SQL Server database. If necessary, SQL Server automatically resolves data conflicts with data changed while you were offline as defined by the merge publication rules.