Because I encountered the problem of processing transactions in webservice last time, I accidentally made an interesting discovery about the connection string enlist setting of OracleConnection while debugging the program.
I read an article before, but I can’t remember what it was. The article said that it is best to set enlist to false. At that time, I didn’t go into details about why it should be set to false. In my program, enlist=false was written directly. . Only now did I discover that there is a subtle relationship between the setting of enlist and the processing of transactions.
Transaction managers generally use two methods to manage, one is called Lightweight Transaction Management, referred to as LTM, and the other is called oleX TM. In simple phase submission, LTM is generally used, while in distributed transaction processing, 2PC is generally used, so the method used is oleX TM.
If enlist=false, it means that subsequent transactions will not be registered in the current transaction, so the current transaction will not become the root of the transaction. If distributed transaction processing is used in the program, it may not be executed correctly (I have not tested this). At this time, the program tells TM to use LTM to manage.
If enlist=true, then the process tells TM that it needs to be managed using oleX TM. Distributed transaction management will be automatically enabled at this time, so if enlist=true is set in the connection string, if the oracle database is used, then the background will When calling oramts.dll, if the MTS for Oracle service is not installed in the development environment, it will prompt that oramts.dll cannot be found. You can download the installation package of this service from Oracle's website. I don't know why Oracle does not provide a separate installation package, but downloads it bundled with odac.
What will happen if you don't configure enlist? This depends on whether your program uses distributed transactions or general transaction processing. TM will automatically react according to the program's request.
Conclusion: enlist has a certain control over the registration of transactions. If my description is wrong, please help correct me.
Link address: http://yanrongpi.cnblogs.com/archive/2006/07/13/450189.html