I've implemented the microsoft code example (see at the bottom) for the use of distributed transactions (with system.transactions and MTS support). The code works fine as long as I use only MS sqlserver.
Well, I tried one connection to an oracle database and one connection to the sqlserver - and here the trouble starts ;-)
Oracle doesn't care about the transaction. After the command is executed the changes are made to the oracle database at once (no commit has occured at that point) even if the second command isn't successfull.
I suppose at the moment that the problem must be something around the interaction between MTS and oracle database, more precisly the oracle Services for MTS.
I've installed the odp.net client (ODAC1020221.exe).
The installer tells me that oracle data access components 10.2.0.2.21 and within the Oracle Services for MTS are installed.
But I cannot find a service with that name in the service list, OracleMTSRecoveryService is listed, but I'm not sure if that's the right one.
So here are my questions:
What's the name for 'Oracle Services for MTS' in the services list?
Do I have to install more than the odp.net client to get the MTS support running?
Is there a mistake in the code I'm running?
any help is welcome ...
thanx in advance!!!
And here's the code I'm working with:
public class Worker : ServicedComponent
public void Test()
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.RequiresNew, new TimeSpan(0, 5, 0)))
DbProviderFactory theFactory = DbProviderFactories.GetFactory("Oracle.DataAccess.Client");
using (DbConnection connection1 = theFactory.CreateConnection())
connection1.ConnectionString = ".........";
DbCommand command1 = theFactory.CreateCommand();
command1.Connection = connection1;
command1.CommandText = "Insert into user (name, surname,benoid) values ('hans','wurst','32315134512345')";
object returnValue = command1.ExecuteNonQuery();
using (SqlConnection connection2 = new SqlConnection("Data Source=localhost;Database=UserManagement;Trusted_Connection=true;"))
//this command fails
SqlCommand command2 = new SqlCommand("Insert into uuuu (name, vorname) values ('hans','wurst')", connection2);
object retValue = command2.ExecuteNonQuery();
catch (Exception ex)
catch (Exception ex)
hey what's up you figured out your problem with M$DTC/Oracle 11i with ODP.NET trying to do a TransactionScope?
I saw your problem - and I ran into the same. Re: 10g Express + ODP.NET (version 220.127.116.11) > support TransactionScope?
Trying to install "Oracle Services for MTS" not sure how but working on it now. Doc looks old however,
Did you get pass this already?
Yea, I am also having this same issue. Oracle MTS can be stopped and the TransactionScope doesn't complain and all calls get auto committed regardless if we do a Complete() or not. I would expect an excpetion to be thrown when this service is stopped.
The service is an http listener, and it's called from the database to determine the outcome of in doubt transactions (when needed). It doesn't have anything to do with performing/enlisting a transaction.
If you're seeing rows committed without calling Complete, that sounds like a legit issue, but it's nothing to do with the service.