'Declaration Public ReadOnly Property OracleLogicalTransaction As OracleLogicalTransaction
public OracleLogicalTransaction OracleLogicalTransaction {get;}
'Declaration Public ReadOnly Property OracleLogicalTransaction As OracleLogicalTransaction
public OracleLogicalTransaction OracleLogicalTransaction {get;}
using System; using Devart.Data.Oracle; class Test { static void Main() { string constr = "User Id=Scott;Password=tiger;Data Source=Ora;"; OracleConnection connection = new OracleConnection(constr); OracleTransaction transaction = null; OracleCommand command = null; try { connection.Open(); transaction = connection.BeginTransaction(); command = new OracleCommand(connection, "update emp set dept=10 where empno=4321"); command.ExecuteNonQuery(); } catch(Exception e) { Console.WriteLine(e.ToString()); return; } try { transaction.Commit(); } catch(Exception e) { if (e.IsRecoverable) { OracleLogicalTransaction logicalTransaction = connection.OracleLogicalTransaction; logicalTransaction.GetOutcome(); // or logicalTransaction.GetOutcome("scott", "tiger", "inst1"); if (!logicalTransaction.Committed && !logicalTransaction.UserCallCompleted) { // any chosen processing here if a retry is desired. } else { // transaction committed, but was not full completed } } else { // Not recoverable transaction. Rollback (and re-execute). } } } }
Imports Devart.Data.Oracle Class Test Private Shared Sub Main() Dim constr As String = "User Id=Scott;Password=tiger;Data Source=Ora;" Dim connection As New OracleConnection(constr) Dim transaction As OracleTransaction = Nothing Dim command As OracleCommand = Nothing Try connection.Open() transaction = connection.BeginTransaction() command = New OracleCommand(connection, "update emp set dept=10 where empno=4321") command.ExecuteNonQuery() Catch e As Exception Console.WriteLine(e.ToString()) Return End Try Try transaction.Commit() Catch e As Exception If e.IsRecoverable Then Dim logicalTransaction As OracleLogicalTransaction = connection.OracleLogicalTransaction logicalTransaction.GetOutcome() ' or logicalTransaction.GetOutcome("scott", "tiger", "inst1"); ' any chosen processing here if a retry is desired. If Not logicalTransaction.Committed AndAlso Not logicalTransaction.UserCallCompleted Then ' transaction committed, but was not full completed Else End If ' Not recoverable transaction. Rollback (and re-execute). Else End If End Try End Sub End Class
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2