Processing Transactions with Microsoft Transaction Server

  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Microsoft Transaction Server (MTS) has been available for Windows NT since 1996. Its name and evolution indicate that it is mainly a transaction-processing (TP) system. But the fact is that professional Windows developers have exploited MTS more for its ability to manage Component Object Model (COM) objects in Web applications and in similar client/server environments. The MTS framework provides a whole range of application services and is a pivotal element of Microsoft’s Distributed interNet Architecture (DNA). And, by the way, it is an equally capable, if somewhat nontraditional, TP system. In this article, I will show you how MTS-distributed transactions can, in certain cases, span more than one database. This article is for those who are somewhat familiar with COM, TP, and security issues.

Component Services

Anyone who has implemented an Active Server Pages (ASP) application running on Internet Information Server (IIS) Version 4.0 has, whether he knows it or not, used the component services provided by MTS. In this version of IIS, MTS is fully integrated; IIS won’t work without it. Even the simplest ASP applications use system components hosted by MTS. MTS is as a component host platform, providing access to COM and ActiveX objects in client/server application domains, such as ASP. MTS acts as a surrogate, comprising the runtime environment for the component objects used by external agents, such as IIS and ASP.

But wait a minute. Isn’t one of the “big ideas” about COM that it’s a binary standard for components that allows you to create objects that can run in any COM environment? If so, why introduce MTS, a “middleman” runtime environment that could only harm the performance of the application? The payback is the management features that MTS provides. You can use MTS facilities to control which agents have authority over your components. You can force components to run under a particular user profile. And, yes, you can, with the help of the Microsoft Distributed Transaction Coordinator (DTC), set up database transaction boundaries in your applications. With the MTS Explorer tool, sets of components, or “packages,” can be installed in MTS to share runtime attributes. Finally, most of these runtime attributes are under the control of an on-site administrator

(and are defaulted by the programmer), so the application can easily be adapted to certain real-world conditions.

Name Game

MTS is part of the Windows NT Server 4.0 Option Pack, which is freely downloadable from Microsoft. It is also installed with the newer releases of IIS. In the Windows 2000 release (formerly Windows NT 5.0), Microsoft decided to bundle MTS as part of the operating system and change its name. MTS has become COM+ Services, but the theory of operation and most of the tools are basically the same as NT’s MTS. This article discusses their common features in terms of the MTS version of component management services as distributed in the Option Pack. The underlying concepts of COM+ Services are identical to MTS, but some of the management tools may be slightly different in their approach. MTS component programmers needn’t worry much about the name change, either, since the MTS interfaces are completely compatible and will allow their component objects to run on both the Windows 2000 and the Windows NT platforms.

The NT Option Pack can be installed on any Windows NT 4.0 system, and it contains IIS and MTS as well as other related system add-ons, such as Microsoft Message Queue Server (MMQS). When installing the Option Pack, select Custom installation, then the Internet Service Manager, and, finally, Transaction Server Explorer to make sure these tools are installed. If you have a recent version of IIS installed on your Windows NT 4.0 Server machine, you may not need to install the Option Pack, because MTS and the other tools will have already been installed as part of the IIS upgrade. As mentioned previously, Windows 2000 comes with the equivalent COM+ Services already installed. Windows 95/98 users can play, too: MTS and Personal Web Server (a scaled-down version of IIS) can be installed on these platforms with the NT 4.0 Option Pack. Note that, on Windows 95, Distributed COM (DCOM) support (also a free OS enhancement available from Microsoft at www. must be installed before MTS.

MTS Transaction Processing

MTS provides the TP framework for components, but it has a lot of help. MTS cannot, by itself, provide the traditional commit and rollback functions associated with TP; these functions must be provided by the database management system (DBMS), or data source, in use by a component object running in MTS. So why not just use the data source’s TP functionality directly? The beauty of MTS transactions is that they may be transparently distributed over more than one component object and over more than one underlying data source. You can use MTS to coordinate a transaction encompassing several component instances simultaneously, some or all of which may be using a different database or database connection.

Traditionally, TP environments have consisted of ad hoc, proprietary solutions. They usually consist of APIs or commands called to initialize and shut down the environment, in addition to the commit and rollback APIs or commands. These work great if you are accessing a single database. In a world where data is increasingly distributed, application data may come from several different sources. Distributed transaction processing and the “two-phase commit” protocol involve the coordination of the TP environments of each data source taking part in the transaction. Two-phase commit ensures that transactions applied to more than one data source are complete on all data sources or none at all. This can be accomplished with a lot of DBMS manuals and some advanced application programming or more easily with system “middleware” designed to facilitate a solution.

MTS and DTC dramatically reduce the effort involved in maintaining TP environments on separate data sources by consolidating transactions in the MTS context. So even if you only use one data source now, it may be worth the effort to investigate using MTS TP; in some cases, it may even be simpler than using the proprietary TP

environment. Another reason to consider using MTS for distributed TP is that it is an integral part of IIS. Transaction-oriented Web applications may be designed using Active Server Pages with your modular business logic contained in COM components.

Distributed Transaction Coordinator

The DTC is a Windows NT service. Its sole purpose is to coordinate transactions encompassing separate data sources. It “holds” the transaction context for one or more data sources being accessed by one or more component objects. While the component programmer uses only one transaction context, the MTS transaction context, DTC juggles separate transaction contexts for each data source being accessed by an object. For DTC to manage the transaction context of a particular data source, it must be able to access that transaction context in a uniform way. The data source provider implements so-called Resource Manager functions in its ODBC or OLE DB driver implementation. Most OLE DB provider implementations include a Resource Manager for participating in DTC. DTC communicates with Resource Managers via the XA protocol, a standard for distributed TP developed by The Open Group vendor consortium, or the OLE Transactions COM interfaces. In either case, the Resource Manager and DTC may run on either one machine or separate networked computers. Figure 1 (page 103) shows an example scenario where the relationship between two data sources (in this case, SQL Server and IBM AS/400 databases) is DTC and an application.

DTC is closely integrated with MTS. MTS facilities discussed in the next section allow component objects running in MTS to exploit the features of DTC in a very simple, configurable way.

Components for MTS Transactions

Component objects running in MTS have a runtime context. This context can be thought of as a “session” that encompasses the lifetime of the object and provides access to the resources of the environment. A component object running in MTS obtains a reference to its object context via the MTS “global” method GetObjectContext. The object reference returned by GetObjectContext implements the IObjectContext interface. This interface includes methods resembling the traditional commit and rollback functions, named SetComplete and SetAbort. The component object participating in a transaction may call SetComplete when it has successfully completed its operation. This notifies MTS that, as far as the object is concerned, it completed its operations successfully and any changes to the data sources accessed may be committed. In the opposite case, SetAbort is called when MTS is to be notified that things didn’t work out, and the transaction should be aborted. Note that these methods indicate a transaction boundary only within the component instance. An MTS transaction may encompass more than one component object.

Other than these and a few other IObjectContext method calls, the object participating in an MTS transaction need not have any awareness of the transaction context. Normal database access using Microsoft ADO and other mechanisms will be protected by the transaction, provided the data sources being used implement the Resource Manager functions. Direct ODBC access can also be protected with MTS transactions with some restrictions.

Initiating a Transaction

MTS transactions come in two flavors: automatic and “client-initiated.” The TransactionContext object may be used to manually create a new transaction. The MTS application (the client) instantiates the TransactionContext object and then uses the CreateInstance method to create the application’s component instances. These new components (and any components they subsequently create) will participate in the transaction denoted by the originating TransactionContext object. When the transaction is complete, the application will call the TransactionContext object’s Abort or Commit method

to end the transaction. Abort will roll back all the database work of the objects participating in the transaction. Commit confirms the changes if none of the components have called the SetAbort or DisableCommit method of their ObjectContext object. Client-initiated transactions offer the programmer the most control over transaction timing.

Automatic transactions are initiated by the MTS runtime when a component that has been marked as requiring a transaction is instantiated. As shown in Figure 2 (page 103), a component installed in MTS has a Transaction support property. This property has four possible values:

• Requires a transaction
• Requires a new transaction
• Supports transactions
• Does not support transactions

These values tell MTS how to handle transaction contexts when creating a new component instance. If a component instance Requires a transaction but is created by a different component instance not participating in a transaction, a transaction is automatically created for it to run in. If the instance is created by a different component instance already participating in a transaction, it, too, will participate in the transaction. So, regardless of the state before the object’s creation, MTS ensures that it runs in a transaction context. Similarly guaranteed are components marked as Requires a new transaction, except that MTS always creates a new transaction context for the new instance, regardless of whether or not the parent component is already participating in a transaction. Supports transactions indicates that the component will participate in the transaction only if one exists when it is created. By default, components are installed in MTS with the Does not support transactions property, indicating that the component will not participate in transactions.

An automatic transaction is complete when the object that caused its creation calls SetComplete or SetAbort. Note that calling these methods from other objects participating in the transaction does not end the transaction immediately, but such calls do affect the eventual outcome. Success must win a unanimous vote; if any component object in the transaction calls SetAbort, the transaction is doomed to failure, delayed only by the final SetComplete or SetAbort call of the transaction’s “parent” object.

Although automatic transactions reduce the burden of the application to support transactions, the sequence of component object creation must be carefully considered to avoid unnecessary nested transactions. Because the application programmer is subject to the rules of automatic transactions whether or not client-initiated transactions are being used, it may reduce the complexity of a program to refrain from using client-initiated transactions.

Initiating Transactions in ASP Pages

Finally, ASP scripts may control the creation of a transaction for the components instantiated within the script by using a directive in the “@” tag of the script. This tag usually only designates the language interpreter for the script. However, it can also designate the transaction property of the page as in the following:

<%@ LANGUAGE=VBScript TRANSACTION=Requires_New %>

The TRANSACTION property value may be one of the usual four values: Required, Requires_New, Supported, or Not_Supported. Because a transaction initiated with this tag is under the control of ASP, event subroutines such as the following are the only methods of observing the result of the transaction. This allows the ASP script programmer to tailor responses to the user based on the success or failure of a page transaction. These subroutines would be placed in the same script as the above tag:


Sub OnTransactionCommit()

Response.Write “

Transaction committed!

End Sub

Sub OnTransactionAbort()

Response.Write “

Transaction aborted!


Consistency Control

Another pair of interesting methods of the ObjectContext object are DisableCommit and EnableCommit. A component instance participating in a transaction uses these to maintain control during critical operations. DisableCommit is called to force any subsequent attempts to commit the transaction, by itself or by any other component or mechanism, to fail. For example, a multiple-record update could leave the data in an inconsistent state if failure occurs during the update. It is prudent, especially in a multithreaded application, to protect such a sequence of code with these methods as shown in this VB snippet:

Dim objContext As ObjectContext
Set objContext = GetObjectContext()
‘ Code to perform critical data source update here...
‘ Commitment attempts will fail until the next line.

Not Such an Odd Name After All

So MTS really is about transaction processing, at least partially. The TP features you’ve seen here allow all three levels of Web application development to shape a useful transaction strategy. The component programmer may use client-initiated transactions and the transaction context to establish and manipulate transactions. Alternatively, automatic transactions can be influenced by the ASP scriptwriter, with the TRANSACTION= tag and the page-level event subroutines. In addition, the MTS administrator may choose which components should and should not participate in transactions and observe transaction progress using the MTS Explorer tool. You’ve also seen how the powerful MTS/DTC combination simplifies the implementation of single-transaction-protected access to more than one database (even the databases of different vendors!). Try that with your proprietary TP solutions. The true utility of MTS, however, is its intelligent integration of several related database and distributed component programming features, including TP.

References and Related Materials

• “IBM DB2 products deliver support for Microsoft Transaction Server”:

• Microsoft COM Web site:

• Microsoft Windows NT Server download page:

• MSDN online Web Workshop—Server Technologies:

• Professional MTS and MSMQ Programming with VB and ASP. Alex Homer and David Sussman. Chicago, Illinois: Wrox Press Inc., 1998


Manager (SQL Server)

SQL Server AS/400

Context Object

Client Application (ASP Script, Windows Program) Component




Manager (IBM DB2 Connect IEE)

Transaction Control Data Flow

Figure 1: Microsoft DTC allows an application transaction to be a distributed transaction, consolidating the transaction capabilities of more than one data source.

Processing_Transactions_with_Microsoft_Transaction_Server06-00.png 395x379

Figure 2: The MTS Explorer tool allows you to examine a component’s various properties.



Support MC Press Online





  • White Paper: Node.js for Enterprise IBM i Modernization

    SB Profound WP 5539

    If your business is thinking about modernizing your legacy IBM i (also known as AS/400 or iSeries) applications, you will want to read this white paper first!

    Download this paper and learn how Node.js can ensure that you:
    - Modernize on-time and budget - no more lengthy, costly, disruptive app rewrites!
    - Retain your IBM i systems of record
    - Find and hire new development talent
    - Integrate new Node.js applications with your existing RPG, Java, .Net, and PHP apps
    - Extend your IBM i capabilties to include Watson API, Cloud, and Internet of Things

    Read Node.js for Enterprise IBM i Modernization Now!


  • Profound Logic Solution Guide

    SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation.
    Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects.
    The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the companyare not aligned with the current IT environment.

    Get your copy of this important guide today!


  • 2022 IBM i Marketplace Survey Results

    Fortra2022 marks the eighth edition of the IBM i Marketplace Survey Results. Each year, Fortra captures data on how businesses use the IBM i platform and the IT and cybersecurity initiatives it supports.

    Over the years, this survey has become a true industry benchmark, revealing to readers the trends that are shaping and driving the market and providing insight into what the future may bring for this technology.

  • Brunswick bowls a perfect 300 with LANSA!

    FortraBrunswick is the leader in bowling products, services, and industry expertise for the development and renovation of new and existing bowling centers and mixed-use recreation facilities across the entertainment industry. However, the lifeblood of Brunswick’s capital equipment business was running on a 15-year-old software application written in Visual Basic 6 (VB6) with a SQL Server back-end. The application was at the end of its life and needed to be replaced.
    With the help of Visual LANSA, they found an easy-to-use, long-term platform that enabled their team to collaborate, innovate, and integrate with existing systems and databases within a single platform.
    Read the case study to learn how they achieved success and increased the speed of development by 30% with Visual LANSA.


  • Progressive Web Apps: Create a Universal Experience Across All Devices

    LANSAProgressive Web Apps allow you to reach anyone, anywhere, and on any device with a single unified codebase. This means that your applications—regardless of browser, device, or platform—instantly become more reliable and consistent. They are the present and future of application development, and more and more businesses are catching on.
    Download this whitepaper and learn:

    • How PWAs support fast application development and streamline DevOps
    • How to give your business a competitive edge using PWAs
    • What makes progressive web apps so versatile, both online and offline



  • The Power of Coding in a Low-Code Solution

    LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed.
    Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

    • Discover the benefits of Low-code's quick application creation
    • Understand the differences in model-based and language-based Low-Code platforms
    • Explore the strengths of LANSA's Low-Code Solution to Low-Code’s biggest drawbacks



  • Why Migrate When You Can Modernize?

    LANSABusiness users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.
    In this white paper, you’ll learn how to think of these issues as opportunities rather than problems. We’ll explore motivations to migrate or modernize, their risks and considerations you should be aware of before embarking on a (migration or modernization) project.
    Lastly, we’ll discuss how modernizing IBM i applications with optimized business workflows, integration with other technologies and new mobile and web user interfaces will enable IT – and the business – to experience time-added value and much more.


  • UPDATED: Developer Kit: Making a Business Case for Modernization and Beyond

    Profound Logic Software, Inc.Having trouble getting management approval for modernization projects? The problem may be you're not speaking enough "business" to them.

    This Developer Kit provides you study-backed data and a ready-to-use business case template to help get your very next development project approved!

  • What to Do When Your AS/400 Talent Retires

    FortraIT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators is small.

    This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn:

    • Why IBM i skills depletion is a top concern
    • How leading organizations are coping
    • Where automation will make the biggest impact


  • Node.js on IBM i Webinar Series Pt. 2: Setting Up Your Development Tools

    Profound Logic Software, Inc.Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. In Part 2, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Attend this webinar to learn:

    • Different tools to develop Node.js applications on IBM i
    • Debugging Node.js
    • The basics of Git and tools to help those new to it
    • Using as a pre-built development environment



  • Expert Tips for IBM i Security: Beyond the Basics

    SB PowerTech WC GenericIn this session, IBM i security expert Robin Tatam provides a quick recap of IBM i security basics and guides you through some advanced cybersecurity techniques that can help you take data protection to the next level. Robin will cover:

    • Reducing the risk posed by special authorities
    • Establishing object-level security
    • Overseeing user actions and data access

    Don't miss this chance to take your knowledge of IBM i security beyond the basics.



  • 5 IBM i Security Quick Wins

    SB PowerTech WC GenericIn today’s threat landscape, upper management is laser-focused on cybersecurity. You need to make progress in securing your systems—and make it fast.
    There’s no shortage of actions you could take, but what tactics will actually deliver the results you need? And how can you find a security strategy that fits your budget and time constraints?
    Join top IBM i security expert Robin Tatam as he outlines the five fastest and most impactful changes you can make to strengthen IBM i security this year.
    Your system didn’t become unsecure overnight and you won’t be able to turn it around overnight either. But quick wins are possible with IBM i security, and Robin Tatam will show you how to achieve them.

  • Security Bulletin: Malware Infection Discovered on IBM i Server!

    SB PowerTech WC GenericMalicious programs can bring entire businesses to their knees—and IBM i shops are not immune. It’s critical to grasp the true impact malware can have on IBM i and the network that connects to it. Attend this webinar to gain a thorough understanding of the relationships between:

    • Viruses, native objects, and the integrated file system (IFS)
    • Power Systems and Windows-based viruses and malware
    • PC-based anti-virus scanning versus native IBM i scanning

    There are a number of ways you can minimize your exposure to viruses. IBM i security expert Sandi Moore explains the facts, including how to ensure you're fully protected and compliant with regulations such as PCI.



  • Encryption on IBM i Simplified

    SB PowerTech WC GenericDB2 Field Procedures (FieldProcs) were introduced in IBM i 7.1 and have greatly simplified encryption, often without requiring any application changes. Now you can quickly encrypt sensitive data on the IBM i including PII, PCI, PHI data in your physical files and tables.
    Watch this webinar to learn how you can quickly implement encryption on the IBM i. During the webinar, security expert Robin Tatam will show you how to:

    • Use Field Procedures to automate encryption and decryption
    • Restrict and mask field level access by user or group
    • Meet compliance requirements with effective key management and audit trails


  • Lessons Learned from IBM i Cyber Attacks

    SB PowerTech WC GenericDespite the many options IBM has provided to protect your systems and data, many organizations still struggle to apply appropriate security controls.
    In this webinar, you'll get insight into how the criminals accessed these systems, the fallout from these attacks, and how the incidents could have been avoided by following security best practices.

    • Learn which security gaps cyber criminals love most
    • Find out how other IBM i organizations have fallen victim
    • Get the details on policies and processes you can implement to protect your organization, even when staff works from home

    You will learn the steps you can take to avoid the mistakes made in these examples, as well as other inadequate and misconfigured settings that put businesses at risk.



  • The Power of Coding in a Low-Code Solution

    SB PowerTech WC GenericWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed.
    Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

    • Discover the benefits of Low-code's quick application creation
    • Understand the differences in model-based and language-based Low-Code platforms
    • Explore the strengths of LANSA's Low-Code Solution to Low-Code’s biggest drawbacks



  • Node Webinar Series Pt. 1: The World of Node.js on IBM i

    SB Profound WC GenericHave you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.
    Part 1 will teach you what Node.js is, why it's a great option for IBM i shops, and how to take advantage of the ecosystem surrounding Node.
    In addition to background information, our Director of Product Development Scott Klement will demonstrate applications that take advantage of the Node Package Manager (npm).
    Watch Now.

  • The Biggest Mistakes in IBM i Security

    SB Profound WC Generic The Biggest Mistakes in IBM i Security
    Here’s the harsh reality: cybersecurity pros have to get their jobs right every single day, while an attacker only has to succeed once to do incredible damage.
    Whether that’s thousands of exposed records, millions of dollars in fines and legal fees, or diminished share value, it’s easy to judge organizations that fall victim. IBM i enjoys an enviable reputation for security, but no system is impervious to mistakes.
    Join this webinar to learn about the biggest errors made when securing a Power Systems server.
    This knowledge is critical for ensuring integrity of your application data and preventing you from becoming the next Equifax. It’s also essential for complying with all formal regulations, including SOX, PCI, GDPR, and HIPAA
    Watch Now.

  • Comply in 5! Well, actually UNDER 5 minutes!!

    SB CYBRA PPL 5382

    TRY the one package that solves all your document design and printing challenges on all your platforms.

    Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product.

    Request your trial now!

  • Backup and Recovery on IBM i: Your Strategy for the Unexpected

    FortraRobot automates the routine tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:
    - Simplified backup procedures
    - Easy data encryption
    - Save media management
    - Guided restoration
    - Seamless product integration
    Make sure your data survives when catastrophe hits. Try the Robot Backup and Recovery Solution FREE for 30 days.

  • Manage IBM i Messages by Exception with Robot

    SB HelpSystems SC 5413Managing messages on your IBM i can be more than a full-time job if you have to do it manually. How can you be sure you won’t miss important system events?
    Automate your message center with the Robot Message Management Solution. Key features include:
    - Automated message management
    - Tailored notifications and automatic escalation
    - System-wide control of your IBM i partitions
    - Two-way system notifications from your mobile device
    - Seamless product integration
    Try the Robot Message Management Solution FREE for 30 days.

  • Easiest Way to Save Money? Stop Printing IBM i Reports

    FortraRobot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing.
    Manage your reports with the Robot Report Management Solution. Key features include:

    - Automated report distribution
    - View online without delay
    - Browser interface to make notes
    - Custom retention capabilities
    - Seamless product integration
    Rerun another report? Never again. Try the Robot Report Management Solution FREE for 30 days.

  • Hassle-Free IBM i Operations around the Clock

    SB HelpSystems SC 5413For over 30 years, Robot has been a leader in systems management for IBM i.
    Manage your job schedule with the Robot Job Scheduling Solution. Key features include:
    - Automated batch, interactive, and cross-platform scheduling
    - Event-driven dependency processing
    - Centralized monitoring and reporting
    - Audit log and ready-to-use reports
    - Seamless product integration
    Scale your software, not your staff. Try the Robot Job Scheduling Solution FREE for 30 days.