Deploying the PowerBuilder COM server
Once you’ve generated a PowerBuilder COM server, you
can use COM-enabled client applications to create the PowerBuilder COM
objects and access their methods. You can use the server with any
COM-enabled application or deploy it as a package to MTS.
Using a PowerBuilder COM server with a COM-enabled
application
To use a PowerBuilder COM server with a COM-enabled
application:
-
Deploy the PowerBuilder COM server to the user’s
computer. -
Deploy the PowerBuilder virtual machine (PBVM70.DLL)
and any other required modules (such as PBDWE70.DLL or
any required database software) to the computer containing the PowerBuilder COM
server. -
Register the PowerBuilder COM server on the user’s
computer. -
Write a client application that calls PB object functions
in the PowerBuilder COM server.
Registering PowerBuilder COM servers When you deploy a PowerBuilder COM server, you need to add information
to the registry to enable COM to create instances of the server’s
objects. PowerBuilder COM servers are self-registering–you
do not need to create a separate registration file. To register
a PowerBuilder COM server, use the REGSVR32 utility. For example:
1 |
regsvr32.exe <i>path_to_server</i>mycomserver.dll |
If you want to access the server from a remote client, you
need to make an additional change to the registry and you may need
to configure the client for remote access to the server. For more
information, see “Using PowerBuilder COM servers
and objects with DCOM”.
Registering automatically for testing For testing purposes, you can check the box on the General
property page that registers the server on the development computer
automatically when it has been generated. To avoid making unnecessary
registry entries on your computer, check this box only when you
are ready to test the PowerBuilder COM server.
Deploying PowerBuilder COMobjects to MTS
PowerBuilder COM objects can be deployed directly to MTS or
imported into MTS as MTS components.
Server requirements
The server to which you deploy a PowerBuilder COM server needs
the following software and files:
- MTS 2.0 or
greater - NT 4.0 with Service pack 3 or later
- PowerBuilder COM objects using database connections
via ODBC drivers (ODBC 3.0 or greater) - PowerBuilder deployment DLLs installed and in the
user’s path - PowerBuilder COM server DLL(s) on a local file system
If MTS is installed
If MTS is installed and running on the computer where you
build the PowerBuilder COM server, you can deploy directly to MTS
from the Project painter. You can also create a PAK file that you
can use to import the package into an MTS server on another computer,
and a client configuration utility that adds to a client computer
all the information required to use the components in the package,
including registry information and the component’s type
library. These options are available on the MTS Package property
sheet in the Project painter.
About registry information If you import the package into an MTS server on another computer,
verify that the path information in both the package and the client
configuration utility is correct. Supporting files such as PBVM70.DLL
may be installed in a different location.
If MTS is not installed
To deploy PowerBuilder COM objects to an MTS server running
on a different computer, you need to complete the following steps:
- Deploy files to the MTS
server computer. - Import PowerBuilder COM objects
into MTS. - Create the client deployment
file. - Install the client deployment
file.
Deploy files to the MTSserver computer
Copy the generated PowerBuilder COM server DLL to a directory
on the MTS server computer’s local file system, along with
PBVM70.DLL and any other required PowerBuilder runtime DLLs.
Import PowerBuilder COM objectsinto MTS
To import PowerBuilder COM objects into MTS, you need to select
the computer where you want to deploy the PowerBuilder COM libraries,
create a package, import the objects, set their transaction properties,
and verify that their interfaces and methods display correctly.
To select the MTS server computer name:
- From the MTS server computer, open the MTS Explorer.
- Select and expand the Computers folder.
- Select and expand the appropriate computer name folder.
To create a new package:
- Select the Packages Installed folder.
- Select New from the popup menu.
-
From the Package Wizard dialog box, select Create An
Empty Package. - Enter a package name.
-
From the Set Package Identity dialog box, select Interactive
User or set a specific user name and password.
Visual content If functions in your custom class user objects inadvertently
display visual content such as a message box, the execution of that
visual content will appear to hang if the component’s user
is set to anything but the interactive user.
To import PowerBuilder COM objects as MTS components:
-
Select and expand the newly created package name
folder. -
Select the component folder and select New>Component
from the popup menu. -
From the Component Wizard dialog box, select the Install
New Component icon. - From the Install Component dialog box, select Add Files.
-
From the File Open dialog box, browse for the COM server
DLL and select Open.The Files To Install listbox is updated showing the PowerBuilder COM server
DLL name as well as components and typelib indicating that components
and the embedded type library were found. The Components Found listbox
displays each component found in the server–for example, PB70.MyComponent.1. - Click Finish.
To set MTS component transaction properties:
- Select one of the component folders.
- Select Properties from the popup menu.
-
From the Component Properties dialog box, select the
Transaction tab and set the attribute you want.
To verify interfaces and methods:
-
For each component, select and expand the interfaces
and methods folders and verify the correct interface names and methods.
Create the client deploymentfile
To create an MTS client deployment file:
- Select the Package folder you want to export.
- Select Export from the popup menu.
-
From the Export dialog box, select a destination directory
for the exported package–for example, C:MTSPACKAGES.This will create two files with the extensions PAK and EXE.
The executable file is the client deployment file.
Install the client deploymentfile
To install the MTS client deployment file:
-
Copy the client deployment file to the client
computer. - Execute the client deployment file.
The deployment file registers all MTS components as remote
objects running on the designated MTS server computer. Your client
application can now create and execute the MTS components using
the appropriate component names.
About server location If you move the server to a different computer, you will need
to update registry information on the client.