Fun with Delphi 4
Or, "What I Learned from Customer Reactions to Delphi 4 at PC Expo"
John Kaster
Enterprise Product Manager, Inprise Corporation
MIDAS 2
Delphi 4 contains components that support developing MIDAS 2 application servers. MIDAS 2 has many new features and improvements over MIDAS 1. (Development support for MIDAS 1 originally shipped with Delphi 3 Client/Server.) New MIDAS 2 features include:
- Business logic development with the visual development of application servers using CORBA, and Microsoft Transaction Server, and improved support for COM and TCP/IP Sockets.
- High performance data retrieval, particularly on low-bandwidth networks.
- The advanced data retrieval includes support for Oracle 8's new Object Relational features like Abstract Data Types, VARRAYs, REFs, and the new BLOB types like CLOB. (You may want to look on our Web site for the white paper on using Delphi 4 to develop Oracle 8 applications.)
- Improved SQL Links for Sybase, Informix, IBM DB2, Microsoft SQL Server, and InterBase.
- Developing the interface to your application server with an advanced visual interface editor supporting both Microsoft and CORBA IDL
- Advanced Data Providing and Resolving with support for:
- Master/Detail and nested tables, where the detail or nested information for a specific parent is sent by the application server to the thin client only when needed
- Abstract Data Types that contain composite information
- Maintained Aggregates, which are automatically updated whenever the values to calculate in the active group change
- Java-based thin-client development for high-performance Delphi-based MIDAS servers
Building a MIDAS Application Server supporting both DCOM and CORBA
Because many Delphi developers are still unfamiliar with MIDAS, I'll show you two demonstrations of it. The first is a simple one that just connects to a single table. Let's begin.
First, we'll create a new application. Since a server is usually a non-visual application, we'll put a label on this form with a caption of "DCOM & CORBA " so we can keep track of when the server is running, and shrink and move the form down to the bottom right of the screen.
Next, using the File|New brings up the Object Repository, where I select the Multitier tab, and double-click on "Remote Data Module."
The Remote Data Module wizard is displayed, asking me for the Class Name, Instancing options for how the RDM should be launched, and the Threading Model. The following explanations for these options are lightly paraphrased from the Delphi 4 help for this wizard.
Class Name
For the Class Name, enter the base name for the Automation interface of your remote data module. The class name for your remote data module (a descendant of TremoteDataModule) will be this name with a T prepended. It will implement an interface named using this name with an I prepended. To enable a client application to access this remote data module, set the ServerName property of the client application's connection component to the base name you specify here.
Instancing
You can use the instancing combo box to indicate how your remote data module application is launched. The following table lists the possible values:
|
Value
|
Meaning
|
|
Internal
|
The remote data module is created in an in-process server. Choose this option when creating a remote data module as part of an active Library (DLL).
|
|
Single Instance
|
Only a single instance of the remote data module is created for each executable. Each client connection launches its own instance of the executable. The remote data module instance is therefore dedicated to a single client.
|
|
Multiple Instance
|
A single instance of the application (process) instantiates all remote data modules created for clients. Each remote data module is dedicated to a single client connection, but they all share the same process space.
|
Threading Model
If you are creating the remote data module in an active library (DLL), use the threading combo box to indicate how client calls are passed to your remote data module's interface. The following table lists the possible values:
|
Value
|
Meaning
|
|
Single
|
The library only receives one client request at a time. Because all client requests are serialized by COM, you don't need to deal with threading issues.
|
|
Apartment
|
Each instance of your remote data module services one request at a time. However, the DLL may handle multiple requests on separate threads if it creates multiple COM objects. Instance data is safe, but you must guard against thread conflicts on global memory.
|
|
Free
|
Your remote data module instances can receive simultaneous client requests on several threads. You must protect instance data as well as global memory against thread conflicts.
|
|
Both
|
The same as Free except that all callbacks to client interfaces are serialized.
|
Here are the options I chose.
After pressing okay, a blank Remote Data Module named "Simple" is created. I drop a TTable component on it from the Data Access tab of the component palette, and set the following properties:
|
Property
|
Value
|
|
DatabaseName
|
DBDEMOS (ships with Delphi)
|
|
Name
|
Customer
|
|
TableName
|
Customer.db
|
I want to provide the data in this table to thin-client applications, so the last step before running the Application Server is indicating that this table should be exported from this module. That can be accomplished by clicking the right mouse button and selecting Export Customer from Data Module:
If you want to verify that the table has become part of the interface for the application server, bring up the type library editor using the View|Type Library menu option. You can see in this screenshot that Customer is part of the external interface to this application server.

Click here to view full size image.
It's about time to run our Application Server, which will automatically compile it. It ran successfully -- I guess you'll just have to take my word for it.
|
Connect with Us