using (System.Transactions.TransactionScope tx =
new System.Transactions.TransactionScope())
{ //... Update data on SQL Server ...
using (OracleConnection cn = new OracleConnection(cnStr))
{ cn.Open();
OracleCommand cmdOra = new OracleCommand(
"INSERT INTO MYLOG VALUES (SYSDATE, 'DEBUG')", cn);
cmdOra.ExecuteNonQuery();
cmdOra.CommandText =
"SELECT LOGTIME FROM MYLOG WHERE REMARK='DEBUG'";
OracleDataReader dr = cmdOra.ExecuteReader();
dr.Read();
Response.Write(dr["LOGTIME"].ToString());
dr.Close();
cn.Close();
}
//tx.Complete();
Response.Write("OK");}
執行環境為Windows 2008 x64 + ASP.NET 2.0 + System.Data.OracleClient + Oracle 11.1.0.6 x64 Client。程式一直傳回ORA-00161: transaction branch length 105 is illegal (maximum allowed 64) 錯誤。
Windows Vista and Windows Server 2008 introduce new MSDTC changes that do not interoperate with older versions of Oracle Services for MTS. Oracle Services for MTS 10.2.0.4 and higher, with the exception of 11.1.0.6, support these new changes on Windows Vista Service Pack 1 and Windows Server 2008 or higher.