Accessing Multiple Databases at Same Time
Zim enables you to connect to more than one remote database at the same time. This enables you to do join operations between different databases on different machines managed by different Zim database servers. No support for distributed concurrency control is available; updates which span multiple servers, though permitted, should be performed with care.
As seen in The Preparation of the Client Database, the object being accessed must have its definition of the fields EntType, RelType or DocType changed to reflect the remote database being accessed via “zimserv”. In other words, all objects with the definition “zimserv” will be accessed in this particular remote Zim database once connected to it because the CONNECT statement links a particular remote database located in the network to the server type “zimserv”. Therefore, a Zim Server connection can only access one remote database at a time. If it is needed to access objects from different remote databases, a set of CONNECT and DISCONNECT commands must be issued for each object located in different remote databases.
There are situations, however, where it is needed to access all objects at the same time from different databases. This can be done by creating more than one instance or aliases of a “zimserv” via the utility modstab. For example, “zimserv1”, “zimserv2” or “Abroad” can be aliases of “zimserv”.
Consequently, if objects have their corresponding fields EntType, RelType or DocType created with any of the above aliases and after the CONNECT, these objects will be available from the correct remote databases.
The following example illustrates this idea. If Customers is locally located (that is, Entype is equal to “zim”), Cities has an EntType equals to “zimserv1” and Orders has an EntType equals to “Abroad”, then the FIND statement will access all customers in the local database that live in cities from the first remote database and that purchased something as defined in the second database:
CONNECT TO “zimserv1” USING (… parameters to access remote database named “zimserv1″…)
CONNECT TO “abroad” USING (… parameters to access remote database named “abroad”…)
FIND Customers LiveIn Cities Issue Orders
DISCONNECT FROM “zimserv1”
DISCONNECT FROM “abroad”