![](images/cover_sm.jpg) |
COM and CORBAŽ Side by Side |
Before you attempt to run the examples, make sure that you have
properly configured your environment.
Click here for information related to the
configuration that I used on my computers.
Click here for an
overview of the Chapter 6 examples.
Chapter 6 covers a wide range of topics. This page breaks the areas into:
MTS Transactions Example
Building the Example
To build the examples, run the _make.bat file in each
of the following directories. Note that the order in which the examples are
built is important.
![bullet](_themes/copy-of-capsules/capbul1a.gif) | book\ch06\mts_example\account |
![bullet](_themes/copy-of-capsules/capbul1a.gif) | book\ch06\mts_example\teller |
![bullet](_themes/copy-of-capsules/capbul1a.gif) | book\ch06\mts_example\client
|
Database Setup
To demonstrate the distributed transaction, you will need to create two SQL server databases.
You should name these two distinct databases as follows:
![bullet](_themes/copy-of-capsules/capbul1a.gif) | SQL Server DB: RDBMS_A |
![bullet](_themes/copy-of-capsules/capbul1a.gif) | SQL Server DB: RDBMS_B |
The schema for each of these databases is as follows:
![bullet](_themes/copy-of-capsules/capbul1a.gif) | Table: Account |
![bullet](_themes/copy-of-capsules/capbul1a.gif) | Fields:
![bullet](_themes/copy-of-capsules/capbul2a.gif) | name varchar 32 nonulls |
![bullet](_themes/copy-of-capsules/capbul2a.gif) | balance real nonulls default 0.0 |
|
After you have created the databases, create the following rows in the Account
tables:
![bullet](_themes/copy-of-capsules/capbul1a.gif) | RDBMS_A: name: 'A' balance: 25.00 |
![bullet](_themes/copy-of-capsules/capbul1a.gif) | RDBMS_B: name: 'B' balance: 45.00 |
The MTS account object will need access to the following ODBC data sources:
![bullet](_themes/copy-of-capsules/capbul1a.gif) | ODBC data source: "RDBMS_A" |
![bullet](_themes/copy-of-capsules/capbul1a.gif) | ODBC data source: "RDBMS_B"
|
Configuring MTS
Start the MTS Explorer (MMC) and do the following:
![bullet](_themes/copy-of-capsules/capbul1a.gif) | Create an MTS package named "Ch6" (the actual name can be of your own
choosing). |
![bullet](_themes/copy-of-capsules/capbul1a.gif) | Add Ch6Account.dll and Ch6Teller.dll to Ch6 package. |
![bullet](_themes/copy-of-capsules/capbul1a.gif) | Change the properties of Ch6.Account.1 and Ch6.Teller.1 so that they both require a transaction. |
![bullet](_themes/copy-of-capsules/capbul1a.gif) | Make sure to disable authorization checking on the security tab for Ch6 package when running these
examples to avoid additional security work that would otherwise be required.
|
Running the Example
To run the client application, execute the _run.bat file located
in:
![bullet](_themes/copy-of-capsules/capbul1a.gif) | book\ch06\mts_example\client
|
Remarks
![bullet](_themes/copy-of-capsules/capbul1a.gif) | The MTS account component assumes that mdac has been run
|
![bullet](_themes/copy-of-capsules/capbul1a.gif) | The MTS account component assumes that ADO is located in "c:\Progra~1\Common~1\System\ado".
An import directive assumes this directory location when importing msado15.dll
as a type library.
|
DCOM Security Example
Building the Example
To build the examples, run the _make.bat file in each
of the following directories. Note that the order in which the examples are
built is important.
![bullet](_themes/copy-of-capsules/capbul1a.gif) | book\ch06\com_security\com_agent |
![bullet](_themes/copy-of-capsules/capbul1a.gif) | book\ch06\com_security\com_agent\ProxyStub |
![bullet](_themes/copy-of-capsules/capbul1a.gif) | book\ch06\com_security\com_client
|
Running the Example
To run the client application, execute the _run.bat file located
in:
![bullet](_themes/copy-of-capsules/capbul1a.gif) | book\ch06\com_security\client
|
Remarks
![bullet](_themes/copy-of-capsules/capbul1a.gif) | To better understand how impersonation works, you should set up the com_agent
COM server to run under a different identity. This is accomplished by using dcomcnfg.exe.
|
![bullet](_themes/copy-of-capsules/capbul1a.gif) | To better understand DCOM security, this example should be tested across two machines to demonstrate packet privacy
(packet privacy does not come into play when running the client and server
on the same machine).
|
![bullet](_themes/copy-of-capsules/capbul1a.gif) | Make sure to install both both client and proxy-stub DLL on separate machine from
the server.
|
![bullet](_themes/copy-of-capsules/capbul1a.gif) | Note that although the COM interface could rely on type-library
marshaling, a proxy-stub DLL is used because of a bug with security. This
bug was a problem using VC++ 5.0 and NT SP3.
|
MTS Security Example
Building the Example
To build the examples, run the _make.bat file in each
of the following directories. Note that the order in which the examples are
built is important.
![bullet](_themes/copy-of-capsules/capbul1a.gif) | book\ch06\com_security\mts_secure_account |
![bullet](_themes/copy-of-capsules/capbul1a.gif) | book\ch06\com_security\mts_secure_client
|
Configuring MTS
Start the MTS Explorer (MMC) and do the following:
![bullet](_themes/copy-of-capsules/capbul1a.gif) | Create an MTS package named "Ch6" (the actual name can be of your own
choosing). |
![bullet](_themes/copy-of-capsules/capbul1a.gif) | Add MtsSecureAccount.dll to the Ch6 package. |
![bullet](_themes/copy-of-capsules/capbul1a.gif) | Create "Savers" and "Spenders" roles in Ch6 package. |
![bullet](_themes/copy-of-capsules/capbul1a.gif) | Add appropriate users to "Users" of "Savers" or "Spenders" role. |
![bullet](_themes/copy-of-capsules/capbul1a.gif) | Add appropriate roles to "Role Membership" of Ch6.MtsSecureAccount component. |
![bullet](_themes/copy-of-capsules/capbul1a.gif) | Make sure to "shut down" the MTS package whenever it is changed to make sure that it picks up new settings.
|
Running the Example
To run the client application, execute the _run.bat file located
in:
![bullet](_themes/copy-of-capsules/capbul1a.gif) | book\ch06\com_security\mts_secure_client
|
Remarks
![bullet](_themes/copy-of-capsules/capbul1a.gif) | Make sure to rebuild the client whenever the server is reinstalled.
Depending on the compatibility mode used in the server project, VB likes to
change the GUIDs after every recompile.
|
MSMQ Example
Building the Example
To build the examples, run the _make.bat file in each
of the following directories.
![bullet](_themes/copy-of-capsules/capbul1a.gif) | book\ch06\msmq_example\market |
![bullet](_themes/copy-of-capsules/capbul1a.gif) | book\ch06\msmq_example\trader
|
Running the Example
To run the market and trader applications, execute the _run.bat file located
in:
![bullet](_themes/copy-of-capsules/capbul1a.gif) | book\ch06\msmq_example\market |
![bullet](_themes/copy-of-capsules/capbul1a.gif) | book\ch06\msmq_example\trader
|
Remarks
![bullet](_themes/copy-of-capsules/capbul1a.gif) | MSMQ must be installed on all machines where the market and trader
applications are run.
|
![bullet](_themes/copy-of-capsules/capbul1a.gif) | Note that the market and trader applications are hardwired to use "scarpia"
as the MSMQ queue host. |
|