Installing an MTS Component

Microsoft has made it simple to manage components via MTS Explorer. Figure 43.4 readily shows all packages that have been installed. Following are the steps of installing a component under MTS control. For this example, the Sample Bank package that comes with MTS sample code will be used (c:\Program Files\Mts\Samples\Packages\Sample Bank.PAK).

Figure 43.4. The MTS Explorer: Packages installed.


Creating a Package

Before you install a new component in MTS, you must decide on which package you want the component to be a member. This example will show the install of a prebuilt package:

  1. Open the MTS Explorer.

  2. Open the My Computer icon and select the Packages Installed folder.

  3. Right-click the Packages Installed folder, and select New, Package.

  4. Select Install Pre-Built Package on the Package Wizard screen. This is for packages that were distributed to you, such as the Sample Banking package with MTS. Figure 43.5 shows these two options.

    Figure 43.5. The Package Wizard: What do you want to do?



The other option on the Package Wizard screen is Create an Empty Package. This is used to install packages that you have created using VB, or other development tools.

  1. Click on the Add button and browse for the package file you want. Again, in this example, it will be the Sample Bank package located in C:\Program Files\Mts\Samples\Packages\Sample Bank.PAK). Select this file and then click Next. Figure 43.6 shows the package that has been selected to be installed. Alternatively, only a component within this package could have been selected, such as only the Visual Basic components (and not the VJ, and so on components).

    Figure 43.6. The Package Wizard: Package Files to Install dialog box.


  2. Just click Next on the Set Package Identity dialog box. This screen is used to specify what user identity the package will assume while performing its work. In this case, you want the default option of Interactive User.

  3. The component files will be installed into an Install directory of your choice. You might choose the default value of C:\Program Files\Mts\Packages. Click the Next button to finish the install. Figure 43.7 shows a completed install of the Sample Bank package.

    Figure 43.7. The MTS Explorer showing installed package: Sample Bank.


Setting Component Properties

After the components have been installed, you can set properties such as what transaction support you want for these components. In this example, the component properties for the Bank.Account component that was just installed will be set to Requires a Transaction. The following steps accomplish this:

  1. Open the Components folder in Sample Bank.

  2. Select the Bank.Account component. Right-click the component and select Properties.

  3. Select the Transaction tab.

  4. Click Requires a Transaction (see Figure 43.8).

    Figure 43.8. The Component Properties tab: Transaction property.


  5. Click OK.


In Visual Basic 6.0, you can set the Transaction Support property during the development of a component by using the MTSTransactionMode property of the class.

The behavior of each of the supported transaction modes is as follows:

  • Requires a transaction?The component must execute within the context of a transaction, although it does not care where the context originates. If the caller has a transaction already, then the called component will use the existing transaction. If the caller does not have a transaction, then MTS automatically creates a new transaction for the component.

  • Requires a new transaction?The component must always establish its own transaction context. Regardless of whether the calling application has a transaction context, MTS automatically creates a new transaction context object for the component.

  • Supports transactions?The component does not care whether a transaction context is in place.

  • Does not support transactions?The component cannot support a transaction, and the CreateInstance method from within a context object will fail.

    Part III: SQL Server Administration
    Part IV: Transact-SQL
    Part V: SQL Server Internals and Performance Tuning
    Part VI: Additional SQL Server Features