OracleLogicalTransaction Class

The OracleLogicalTransaction class provides detailed information about the logical transaction status. Applications can conclusively determine the outcome of the running transaction during the last database outage, then act accordingly to commit, complete, or rollback the transaction.

Class Inheritance

System.Object

  System.MarshalByRefObject

    Oracle.DataAccess.Client.OracleLogicalTransaction

Declaration

// C#
public sealed class OracleLogicalTransaction

Requirements

Provider ODP.NET, Unmanaged Driver
Assembly Oracle.DataAccess.dll
Namespace Oracle.DataAccess.Client
.NET Framework 3.5, 4.0, 4.5

Thread Safety

All public static methods are thread-safe, although instance methods do not guarantee thread safety.

OracleLogicalTransaction Members

OracleLogicalTransaction members are listed in the following tables.

OracleLogicalTransaction Public Read-Only Properties

OracleLoigcalTransaction public read-only properties are listed in Table 6-87

Table 6-87 OracleLogicalTransaction Public Read-Only Properties

Property Description

Committed

Specifies if the transaction was committed or not

UserCallCompleted

Specifies if the transaction completed and that the information returned may be incomplete and/or not all expected work was completed

UserId

Specifies the user ID that is associated with the connection from which this object was obtained from

DataSource

Specifies the data source, for example TNS alias, that is associated with the connection from which this object was obtained from


OracleLogicalTransaction Private Properties

OracleLoigcalTransaction private properties are listed in Table 6-88

Table 6-88 OracleLogicalTransaction Private Properties

Property Description

OracleConnection

Holds a reference to a "cloned" OracleConnection which is identical to the one that the OracleLogicalTransaction was obtained from.


OracleLogicalTransaction Methods

OracleLoigcalTransaction private properties are listed in Table 6-89

Table 6-89 OracleLogicalTransaction Methods

Property Description

Dispose

This method releases any resources or memory allocated by the object

GetOutcome

This method retrieves the transaction outcome from the database server. The method will determine whether the transaction committed and completed or not.


OracleLogicalTransaction Public Read-Only Properties

OracleLoigcalTransaction public read-only properties are listed in Table 6-90

Table 6-90 OracleLogicalTransaction Public Read-Only Properties

Property Description

Committed

Specifies if the transaction was committed or not

UserCallCompleted

Specifies if the transaction completed and that the information returned may be incomplete and/or not all expected work was completed

UserId

Specifies the user ID that is associated with the connection from which this object was obtained from

DataSource

Specifies the datasource, for example TNS alias, that is associated with the connection from which this object was obtained from


Committed

This property specifies if the transaction was committed or not.

Declaration

// C#
public bool? Committed {get;}

Property Value

bool.

Remarks

If GetOutcome() is not called, the this property holds a null value.

Once GetOutcome() is called, then this property will hold either true or false.

Table 6-91 describes the possible outcomes of the Committed and UserCallCompleted properties.

Table 6-91 Outcome of OracleLogicalTransaction Committed and UserCallCompleted Properties

Committed Value UserCallCompleted Value Outcome

false

false

The call did not execute the commit.

true

true

The call did execute the commit and there was no additional information to return and no more work to do if that call was a PL/SQL procedure.

true

false

The transaction is committed, but the information returned may be incomplete and/or not all expected work was completed. Examples of incomplete information or incomplete work done include: the number of rows modified when using autocommit or commit on success, parameter and function results when calling PL/SQL procedures, or PL/SQL procedures with more work to do after the commit. In order to function correctly, .NET applications that use data returned from the commit must check the UserCallCompleted value.


UserCallCompleted

This property specifies if the transaction completed and that the information returned may be incomplete and/or not all expected work was completed.

Declaration

// C#
public bool? UserCallCompleted {get;}

Property Value

bool

Remarks

If GetOutcome() is not called, the this property holds a null value.

Once GetOutcome() is called, then this property will hold either true or false.

Table 6-91 describes the possible outcomes of the Committed and UserCallCompleted properties.

UserId

This property specifies user ID that is associated with the connection from which this object was obtained form.

Declaration

// C#
public string UserId {get;}

Property Value

The user ID as a string.

DataSource

This property specifies the data source, for example TNS alias, that is associated with the connection from which this object was obtained from.

Declaration

// C#
public string DataSource {get;}

Property Value

The data source as a string.

OracleLogicalTransaction Private Properties

OracleLoigcalTransaction private properties are listed in Table 6-92

Table 6-92 OracleLogicalTransaction Private Properties

Property Description

OracleConnection

Holds a reference to a "cloned" OracleConnection which is identical to the one that the OracleLogicalTransaction was obtained from.


OracleLogicalTransaction Methods

OracleLoigcalTransaction private properties are listed in Table 6-93

Table 6-93 OracleLogicalTransaction Methods

Property Description

Dispose

This method releases any resources or memory allocated by the object

GetOutcome

This method retrieves the transaction outcome from the database server. The method will determine whether the transaction committed and completed or not.


Dispose

This method releases any resources or memory allocated by the object

Declaration

// C#
public void Dispose();

Implements

IDisposable

Remarks

The Dispose method also closes the OracleLogicalTransaction object.

GetOutcome

The GetOutcome method retrieves the transaction outcome from the database server. The method will determine whether the transaction committed and completed or not.

Overload List:

  • GetOutcome()

    This method uses cloned OracleConnection that the OracleLogicalTransaction was obtained from.

    The connection is opened with pooling=false and thus the connection gets severed/closed/freed as soon as the outcome is forced.

    Repeated calls will not incur server round-trip.

  • GetOutcome(string userid, string password, string dataSource)

    This method uses cloned OracleConnection that the OracleLogicalTransaction was obtained from.

    The connection gets severed/closed/freed as soon as the outcome is forced.

    Repeated calls will not incur server round-trip.

Note:

Once one server round-trip is incurred for the GetOutcome() invpcatopm, the PL/SQL ForceOutcome is never invoked again against the server for a given OracleLogicalTransaction object.