Why my transaction promoted to DTC transaction?


Recently we received such kind of issue that, when you simply just open a connection to SQL Server, you can see there was DTC transactions enlisted.

 

However, this only happened for the SQLOLEDB drivers, the SQL Native Client doesn’t have same behavior.

 

The minimum reproduce code :

 

using System;

using System.Collections.Generic;

using System.Data.Common;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Transactions;

using static System.Console;

using System.Data.SqlClient;

namespace DTCTest

{

    class Program

    {

        const string connStrGoodOleDB = « Provider=SQLOLEDB;DataTypeCompatibility=80;SERVER=MYTESTLAB;UID=testlogin; » +

      « PWD=Password01!;APP=SQLOLEDBAPP;WSID=;DATABASE=TEST »;

 

        private static object writer;

 

        public static DbProviderFactory GetOleDbFactory()

        {