A Sip From The Firehose: Wednesday, August 27, 1997

By: David Intersimone

Abstract: Building a Multi-Tier Application with NO Lines of Code

    Wednesday, August 27, 1997
    Scotts Valley, CA

    Building a Multi-Tier Application with NO Lines of Code

    Delphi and MIDAS
    Those of you who follow SipFH will remember the column I wrote back in March on Multi-tier Computing. In that column I outlined what multi-tier computing was and talked about Borland's goal of making development of multi-tier applications as easy as possible. That column was written before Delphi 3 Client/Server Suite was announced and shipped.

    How easy did we make multi-tier development? How about building a multi-tier application with NO LINES OF CODE? Easy enough? Of course some coding will be required to build real world applications.

    Delphi 3 Client/Server Suite provides the tools and components that allow you to build and test robust scalable enterprise applications. MIDAS (Multi-tier Distributed Application Services) provides the deployment vehicle for server applications. MIDAS allows you to run the Borland Database Engine(BDE), Business Object Broker , Remote DataBroker and ConstraintBroker and your server applications on multiple servers (requires purchasing a copy MIDAS per server).

    A Simple Multi-Tier Application - Customers and Orders
    Let's build a customer service multi-tier application in three easy steps. If you need more technical information, check our Charlie Calvert's article, A Technical View of MIDAS.

    We'll put the user interface for the customer and orders application on a thin client machine (Windows 95). On an application server machine (Windows NT4) we'll put MIDAS and the server application. On our database server (Windows NT4) we'll place an InterBase database containing the customer, sales, order and employee information.

    Step 1 - Build the Delphi 3 Server Application
    Building the application server side of a Delphi 3 multi-tier application is a lot like building a plain vanilla Delphi database application. You focus on the database access and business rules using TTable and Tquery components. While your server application can have some type of user interface, normally you would use a simple form with some server application status information.
    Step 1 Instructions

    Step 2 - Build the Delphi 3 Thin Client Application
    Now that the server application is written we can concentrate on the client side. Instead of connecting to the database with TQuery or TTable components (the server used these), our thin client will use the new TClientDataSet and TRemoteServer components. Most of our efforts on the client side will be with the user interface.
    Step 2 Instructions

    Step 3 - Deploy the Mult-Tier Application
    You've now tested your client and server application on the local machine. It's time to deploy the customer and order server to one or more application server machines. You will also want to put the thin client application on one or more user machines. You will need to do a few things to get the machines ready. Delphi 3 Client/Server comes with a multi-tier development license that allows you to use MIDAS' Remote DataBroker, Business Object Broker and ConstraintBroker on multiple machines but limits you to 3 remote server applications registered at a time. To deploy your application you will need a copy of MIDAS for each application server.
    Step 3 Instructions

    Delphi 3 Update - The NEW TMIDASConnection Component
    Included with the new Delphi 3 Client/Server Update is a new component that makes multi-tier development more flexible, the TMIDASConnection component. From the Delphi 3 Client/Server Update help file:

      TMIDASConnection handles a remote server connection in a client application that is part of a multi-tiered application. TMIDASConnection is used in the client portion of a multi-tiered database application to establish and maintain the connection between the client and a remote application server. TMIDASConnection is different from TRemoteServer in that it also supports connections via TCP/IP (TRemoteServer supports DCOM and OLEnterprise). TMIDASConnection objects can:

      • Establish an initial connection to a remote application server using DCOM, TCP/IP sockets, or OLEnterprise.
      • Provide a list of provider names available to client datasets through this connection.
      • Obtain an IProvider interface based on a provider name.
      • Maintain a list of local client datasets that can be serviced through this connection.
      • Drop the connection to the remote application server.

      The TMIDASConnection object establishes the initial connection between the client application and a remote application server using DCOM, TCP/IP sockets, or OLEnterprise. Once the connection is established, the client registers any or all of its client datasets with the remote server, and these client datasets can then communicate directly with the application server's TProvider object through its IProvider interface.

    Note: TMIDASConnection depends on objects in both the VCLDB30.DPL and INET30.DPL packages. If the client application will only be using DCOM to connect to the application server, the dependancy on INET30.DPL can be removed by using TRemoteServer instead.

    Other Sources of MIDAS Information
    There are several white papers available on our web site that will help you be successful building multi-tier applications with Delphi 3 and MIDAS:

    An Open, Scalable Roadmap For The Future
    What used to take many tools, languages, hours and loads of code, now takes a little work and no lines of code with Delphi 3 Client/Server Suite. You can easily build open, scalable and robust multi-tier applications with Delphi and MIDAS. As your business needs grow, you can add more MIDAS servers to meet user demand. If you require an open, flexible, standards-based, enterprise distributed computing infrastructure you can reuse all your work with Entera.

    Happy Multi-Tiering !

    David Intersimone

    P.S.: A zip file is included with the example source code.

Server Response from: ETNASC04