Delphi Multi-layer distributed development (1)

Source: Internet
Author: User

Introduction of distributed multi-tier database development

Delphi proposed by Midas (multi-tier Distributed Application Services Suite multi-tier Distributed Application Server group), is to put the original Two-tier data connection on the server side of the COM components, The client is left with execution files and MIDAS.DLL, COM components on the foreground and server, communicating with each other through the DCOM mechanism.

This multiple layer, called the Application Server (application server), or middleware. This multi-layer distributed work mechanism is mainly based on the following considerations:

1 reduce the maintenance of the client, because the foreground program is relatively simple;

By encapsulating Enterprise Logic in a general-purpose middleware application server, different customers can share the same middle tier (including the web) without having to implement enterprise rules individually for each customer, avoiding the hassle of duplicate development and maintenance. Because the client program is pretty thin (this is the concept of thin clients that are now popular), it's easy to develop and publish.

2 Easy to upgrade, when the middleware upgrade, the client program may not need to change;

3 implementation of distributed data processing, an application distributed on several machines to run, can improve the performance of the application, can also be sensitive parts encapsulated in the middleware, for different users to set different access rights, enhanced security.

4 reduce the number of users directly connected to the database and reduce the cost.

In Delphi 6.0, on the basis of the original Midas, the development of DATASNAP technology, in many details, it provides the original Midas did not have many functions, the use of more convenient.

Datasnap mainly provide communication between client and middleware, not only support COM + technology also support TCP/IP or CORBA, they use similar interfaces and methods, the result is automatically completed by the program, which greatly expands its application scope.

Here are a few examples to illustrate the design of a multi-tier database.

Mainly to solve a few problems: how to build a simple distributed system, how to use SQL, how to transfer additional information and provide server methods to customers, how to build master-slave table structure. By understanding these methods, we can build our own more sophisticated database systems.

These examples, we should not only do, but also understand.

It must be reminded that in addition to the application on the foreground machine, a MIDAS.DLL file must be added to the foreground machine, which is in the server's Winnt\System32 directory.

Server-side Programs

Server-side program is actually a COM project, it is connected to the data source, and then through the interface to contact the client, this COM project must be registered on the server.

First, create a blank project.

File-> New-> other-> multitier-> Remote Data module

dialog box: Coclass name:com The name of the program, the foreground to find COM program (Pct121) instancing: Execution mode, most of multiple Instance (multiple instances)

Threading Model: Threading mode, recommended to use apartment (unit)

Here we will elaborate on these options.

OK, create a window in this window where you can put data controls.

In Viwe-> Type Libray, we can see some of the features of this COM. We can also note the GUID provided by the system for later use.

Add a adotable and set it to point to a database.

Then set a datasetprovider (on DataAccess page) to point to adotable

This completes the server-side programming. Save, compile, register (note, as long as the run is automatically registered on the machine).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.