Archives
 
 
 
  Special
 
 
 
  About Us
 
 
 

Newsletter
Free E-mail Newsletter from BYTE.com

 
    
           
Visit the home page Browse the four-year online archive Download platform-neutral CPU/FPU benchmarks Find information for advertisers, authors, vendors, subscribers Request free information on products written about or advertised in BYTE Submit a press release, or scan recent announcements Talk with BYTE's staff and readers about products and technologies

ArticlesNotes and Relational Data


April 1995 / Special Report / Document Repositories / Notes and Relational Data

In a conventional RDBMS (relational DBMS), a contact management application invariably stores company data in one table and contact information in another. Because there's a many-to-one relationship between contacts and companies, many contact records for a company can share a single company record.

But Notes is a document database, not a relational database, and it just can't work this way. Instead, applications designers typically rely on a useful feature of Notes called named-field inheritance. For instance, an application might present a company form with a button called Create New Contact. Its effect is to compose a new document that inherits the company name, phone number, fax number, and other fields, le aving just the contact name to be entered.

Unfortunately, this company information is now stored in the database twice. But other than their common data, no connection links the two notes, so when you edit one, the other remains unchanged. Worse, if you change the organization note and then create another contact, the new note has the new address, but the older one does not.

One can argue that duplicating data is the only sane approach in a highly distributed, occasionally connected world. Nevertheless, it's often necessary to layer relational capability on top of Notes. There are three ways of doing this: You can build a custom Notes user interface to enforce relational integrity, build a server- or client-based agent to police the data, or tightly link Notes to a relational database.

A custom user interface for Lotus Notes is typically a Windows client program that's written in C and uses the Notes API. Alternatives include Visual Basic (with the right VBX [Visual Basic custom control]) , PowerBuilder, and ViP, the Lotus visual programming interface for Notes. To add relational capability, a custom user interface must notice when a user saves a note so it can search the database for related notes and update them as well.

A server-based agent, scheduled to run at timed intervals, can achieve the same results. Written in C to the Notes API, it runs on the server as an add-in task. Of course, you have to compile the program with a C compiler that's native to the server operating system, dedicate a server for development and testing, and (if you want to use the add-in on a different platform) port it. Moreover, if the add-in program blows up while running on a production machine, it usually takes the server down with it.

A good alternative to the server add-in program is a Notes API program running on a client PC. A simple periodic task launcher can run an agent (or a series of them), wait a few minutes, and then start from the top again. If the task launcher and the agents take th eir configuration parameters from a Notes database on a server, the whole show can be controlled remotely (except for reboots) and the workstation can be locked in a cupboard.

A tight link between a Lotus Notes database and a SQL server usually takes the form of a program that's linked with both servers' API libraries (e.g., Notes and the Sybase DBLIB) and run by a scheduler task (see the figure " Synchronizing Notes and SQL "). Each time it runs, it must look first at one side (e.g., the Notes database) and ensure that all modifications made since the last time the database was visited are used to update the SQL server. Then it picks up all modifications made to the SQL database since the last time and uses them to update the Notes database.


Synchronizing Notes and SQL

illustration_link (19 Kbytes)

A program linked to two APIs--that of Notes an d that of a SQL server--can run on a scheduled basis to synchronize a Notes database with a relational database. Alternatively, it can be activated by SQL triggers or the Notes equivalant, DBHOOKVEC.


Up to the Special Report section contentsGo to previous article: Document RepositoriesGo to next article: In The Pipeline: Notes 4.0SearchSend a comment on this articleSubscribe to BYTE or BYTE on CD-ROM  
Flexible C++
Matthew Wilson
My approach to software engineering is far more pragmatic than it is theoretical--and no language better exemplifies this than C++.

more...

BYTE Digest

BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin, and dozens of other CMP publications—bringing you critical news and information about wireless communication, computer security, software development, embedded systems, and more!

Find out more

BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
 
The Best of BYTE Volume 1: Programming Languages
The Best of BYTE
Volume 1: Programming Languages
In this issue of Best of BYTE, we bring together some of the leading programming language designers and implementors...

Copyright © 2005 CMP Media LLC, Privacy Policy, Your California Privacy rights, Terms of Service
Site comments: webmaster@byte.com
SDMG Web Sites: BYTE.com, C/C++ Users Journal, Dr. Dobb's Journal, MSDN Magazine, New Architect, SD Expo, SD Magazine, Sys Admin, The Perl Journal, UnixReview.com, Windows Developer Network