Using the Client Dataset in an N-Tiered Application
My last two articles demonstrated the use of the client dataset in a two-tier application. The two-tier architecture may be effective in some situations but in many circumstances it suffers from some serious drawbacks. This is where the concept of an n-tiered or multi-tiered architecture comes in.
Using the Client Dataset in an N-Tiered Application - Client Application (Page 3 of 4 )
The client of an n-tiered application looks very much like the client part of a two-tiered application. The only difference is that instead of transacting with the database server, the client interacts with an application server which constitutes the middle tier of the three-tiered architecture. The client application is essentially the presentation layer; its functions are limited to providing GUI for the end user.
To create a light-weight client application, start a new application project and add a client database component to it. But the client dataset component cannot connect to a remote provider on its own, so we will need to add a Datasnap connection component. Delphi provides protocol specific components which can be found in the DataSnapcategory in the tool palette.
TDCOMConnection to connect using DCOM protocol.
TSocketConnection for Windows Socket connection
TWebConnection for HTTP connection and
TSOAPConnection (in the WebServices category) for SOAP
These connection components are different from database connection components like TADOConnection, TSQLConnection and other connection components that connect to the database server. Before adding a datasnap connection object, it will be necessary to analyze your requirements, like what protocol you will be using and so forth. For the purpose of demonstration let us drop a TDCOMConnection object. If the application server is installed, then the interface is available in the server name property of the connection component.