|
Getting started with the MIDAS Client for Java
John Kaster, Enterprise Product Manager
This article is a slightly modified version of the Getting Started Guide for the MIDAS Client for Java 1.0 on-line help that Ginger Wilsbacher, Barbara Tyler and myself wrote. Changes were primarily introduced for flow through the different topics covered in the Guide. It assumes that the installation for the MIDAS Client for Java into JBuilder 2 Client/Server has already been completed.
Introduction
The MIDAS Client for Java (JMidas) components are pure Java components for JBuilder 2 Client/Server. They allow thin clients to communicate with MIDAS servers created with Client/Server and Enterprise editions of either Delphi 4 or C++ Builder 4 (or later versions). These components allow you to rapidly develop and deploy cross-platform distributed database applications without requiring you to invest weeks in learning new protocols and development tools.
- The CorbaConnection component uses a specific Repository ID to establish a connection with the MIDAS server via CORBA, get data from the server, and send back data changes made on the client.
- The ClientDataSet component is based on the JBuilder StorageDataSet component. It contains all of the base class methods for accessing and modifying the data provided by the server. It also handles transferring the data to and from a CorbaConnection component.
This section will guide you through the step-by-step process of first building a Delphi 4-based MIDAS server, then connecting to it from a pure Java thin client. It is written with the assumption that you are somewhat familiar with developing applications in both Delphi 4 Client/Server and JBuilder 2 Client/Server, and that you have already installed the MIDAS Client for Java components in JBuilder.
Building a MIDAS Application Server supporting both DCOM and CORBA
We'll create a new MIDAS Application Server from scratch using Delphi. Even if you're not familiar with the MIDAS components, these steps should be detailed enough to help you create the server.
It's beneficial to see how the data is updated between the client and server, so first we'll provide visual access to the server-based data on the default form for the Delphi application. MIDAS servers are not necessarily visual applications, because they are usually designed to run without user interaction, but this one will have a visual interface.
Use the following sets of steps to build the first form of the Delphi-based MIDAS server.
Setting up the tables
- Choose File|New Application to create a blank form.
- Set the form's Caption property to MIDAS CORBA/DCOM Server (Local Data Access).
- From the Data Access tab on the Component palette, drop three Table components onto the form.
- Select all three components.
- Set their DatabaseName property to DBDEMOS in the Object Inspector.
- Click somewhere else on the form to deselect the three components.
- Set Table1.TableName to Customer.db and set Active to True.
- Set Table2.TableName to Orders.db and set Active to True.
- Set Table3.TableName to Items.db and set Active to True.
Setting up the data sources
- From the Data Access tab of the Component palette, drop three DataSource components onto the form.
- Assign DataSource1.DataSet to Table1.
- Assign DataSource2.DataSet to Table2.
- Assign DataSource3.DataSet to Table3.
- Set Table3.MasterSource to DataSource2.
- Set Table3.MasterFields to OrderNo.
- Set Table2.MasterSource to DataSource1.
- Set Table2.MasterFields to CustNo.
Setting up the visual interface components
- From the Data Controls tab of the Component palette, drop a DBNavigator component and a DBGrid component onto the form.
- From the Additional tab, drop a Splitter component onto the form.
- With the Splitter selected in the Object Inspector, hold down the Shift key and also select the DBNavigator and DBGrid components.
- Set their Align property to alTop.
- Click outside of the components to deselect them, and then reselect the DBNavigator and DBGrid components.
- Set their DataSource property to DataSource1.
- Repeat the seven steps you just did, except set the DataSource property of DBNavigator2 and DBGrid2 to DataSource2.
- Drop a third DBNavigator component onto the form.
- Set DBNavigator3.Align to alTop and resize it if necessary.
- Drop another DBGrid component onto the form.
- Set DBGrid3.Align to alClient.
- Select both DBNavigator3 and DBGrid3.
- Set their DataSource property to DataSource3.
The local data viewing form is now complete, and should look something like this:
Continue to Part II
|