Connecting to an Application Server That Uses Multiple Data Modules

From RAD Studio
Jump to: navigation, search

Go Up to Creating the Client Application

If a COM-based application server uses a main "parent" data module and several child data modules, as described in Using multiple Server data modules, then you need a separate connection component for every data module on the application server. Each connection component represents the connection to a single data module.

While it is possible to have your client application form independent connections to each data module on the application server, it is more efficient to use a single connection to the application server that is shared by all the connection components. That is, you add a single connection component that connects to the "main" data module on the application server, and then, for each "child" data module, add an additional component that shares the connection to the main data module.

To use a single shared connection

  1. For the connection to the main data module, add and set up a connection component as described in Connecting to the Application Server. The only limitation is that you can't use a SOAP connection.
  2. For each child remote data module, use a Datasnap.Win.MConnect.TSharedConnection component.
    • Set its ParentConnection property to the connection component you added in step 1. The TSharedConnection component shares the connection that this main connection establishes.
    • Set its ChildName property to the name of the property on the main remote data module's interface that exposes the interface of the desired child data module.

When you assign the TSharedConnection component placed in step 2 as the value of a client dataset's RemoteServer property, it works as if you were using an entirely independent connection to the child data module. However, the TSharedConnection component uses the connection established by the component you placed in step 1.

See Also