I have a little proof-of-concept distributed transaction application that is doing a simple insert into two tables -- one a MS SQL Server table, the other an Informix Dynamic Server table. The problem comes when an exception is thrown. If I use the OLE DB driver for Informix, everything works fine -- both inserts roll back; if I use the .NET Data Provider for Informix, the Informix insert does not roll back.
Does anyone have any ideas as to what is going on?
In the code snippet, you will notice the commented-out EnlistTransaction() method. When explicitly called, I get an exception indicating that the method is not implemented.
Code snippet:
private void doTransaction(Boolean commitIndicator)
{
using (TransactionScope tscope = new TransactionScope())
{
using (SqlConnection cn = new SqlConnection { ConnectionString = sql2008Settings.ConnectionString })
{
cn.Open();
using (SqlCommand cmd = cn.CreateCommand())
{
cmd.CommandText = "insert into uom (uom) values ('Test')";
int count = cmd.ExecuteNonQuery();
}
}
using (IfxConnection cn = new IfxConnection())
{
cn.ConnectionString = idnSettings.ConnectionString;
cn.Open();
//cn.EnlistTransaction(Transaction.Current);
using (IfxCommand cmd = cn.CreateCommand())
{
cmd.CommandText = "insert into table_ (code_, description) values ('JEP', 'Test')";
int count = cmd.ExecuteNonQuery();
}
}
if (commitIndicator)
{
}
else
{
throw new Exception("planned failure");
}
tscope.Complete();
}
}
Connection Strings: