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.
System.Object
System.MarshalByRefObject
Oracle.DataAccess.Client.OracleLogicalTransaction
// C# public sealed class OracleLogicalTransaction
Provider | ODP.NET, Unmanaged Driver | ODP.NET, Managed Driver |
Assembly | Oracle.DataAccess.dll |
Oracle.ManagedDataAccess.dll |
Namespace | Oracle.DataAccess.Client |
Oracle.ManagedDataAccess.Client |
.NET Framework | 3.5, 4.0, 4.5, 4.6 | 4.0, 4.5, 4.6 |
All public static methods are thread-safe, although instance methods do not guarantee thread safety.
See Also:
OracleLogicalTransaction
members are listed in the following tables.
OracleLogicalTransaction Public Read-Only Properties
OracleLoigcalTransaction
public read-only properties are listed in Table 6-89
Table 6-89 OracleLogicalTransaction Public Read-Only Properties
Property | Description |
---|---|
Specifies if the transaction was committed or not |
|
Specifies a subset of the connection string used for the transaction running during the last database outage |
|
Specifies the data source, for example TNS alias, that is associated with the connection from which this object was obtained from This property has been deprecated in 12.1.0.2. It will be desupported in a future release. |
|
The logical transaction id is used to determine the commit outcome of the last transaction open in a database session following an outage. |
|
Specifies if the transaction completed and that the information returned may be incomplete and/or not all expected work was completed |
|
Specifies the user ID that is associated with the connection from which this object was obtained from This property has been deprecated in 12.1.0.2. It will be desupported in a future release. |
OracleLogicalTransaction Methods
OracleLoigcalTransaction
methods are listed in Table 6-90
OracleLoigcalTransaction
public read-only properties are listed in Table 6-91
Table 6-91 OracleLogicalTransaction Public Read-Only Properties
Property | Description |
---|---|
Specifies if the transaction was committed or not |
|
Specifies a subset of the connection string used for the transaction running during the last database outage |
|
Specifies the datasource, for example TNS alias, that is associated with the connection from which this object was obtained from This property has been deprecated in 12.1.0.2. It will be desupported in a future release. |
|
The logical transaction id is used to determine the commit outcome of the last transaction open in a database session following an outage. |
|
Specifies if the transaction completed and that the information returned may be incomplete and/or not all expected work was completed |
|
Specifies the user ID that is associated with the connection from which this object was obtained from This property has been deprecated in 12.1.0.2. It will be desupported in a future release. |
See Also:
This property specifies if the transaction was committed or not.
// C# public bool? Committed {get;}
bool
.
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-92 describes the possible outcomes of the Committed
and UserCallCompleted
properties.
Table 6-92 Outcome of OracleLogicalTransaction Committed and UserCallCompleted Properties
Committed Value | UserCallCompleted Value | Outcome |
---|---|---|
|
|
The call did not execute the commit. |
|
|
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. |
|
|
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 |
This property specifies a subset of the connection string used for the transaction running during the last database outage.
// C# public string ConnectionString {get;}
The data source as a string.
This connection string can be useful if the outcome is not known at the time the exception is thrown due to a service that is down. In such a scenario, use the connection string from this property along with the LogicalTransactionId
to determine the outcome of the logical transaction by invoking the static OracleConnection.GetOutcome()
method, once the database or service is back up.
The string returned by this property will contain only the following attributes: User Id
, Proxy user Id
(if not null/empty), Data Source
, and Pooling
(which will be set to false
).
This property specifies the data source, for example TNS alias, that is associated with the connection from which this object was obtained from.
// C# public string DataSource {get;}
The data source as a string.
The logical transaction id is used to determine the commit outcome of the last transaction open in a database session following an outage.
// C# public byte LogicalTransactionId {get;}
byte[]
This logical transaction id can be useful if the outcome is not known at the time the exception is thrown due to a service that is down. In such a scenario, use the byte[]
returned from this property (along with the ConnectionString
) to determine the outcome of the logical transaction by invoking the static OracleConnection.GetOutcome()
method, once the database or service is back up.
This property will return a non-null value only when the outcome is not known. For example when database or service is down, then the outcome is not known.
LogicalTransactionId
property will return null
if the connection has participated in a distributed transaction.
This property specifies if the transaction completed and that the information returned may be incomplete and/or not all expected work was completed.
// C# public bool? UserCallCompleted {get;}
bool
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-92 describes the possible outcomes of the Committed
and UserCallCompleted
properties.
OracleLoigcalTransaction
methods are listed in Table 6-93
Table 6-93 OracleLogicalTransaction Methods
Property | Description |
---|---|
This method releases any resources or memory allocated by the object |
|
This method retrieves the transaction outcome from the database server. The method will determine whether the transaction committed and completed or not. |
This method releases any resources or memory allocated by the object
// C# public void Dispose();
IDisposable
The Dispose
method also closes the OracleLogicalTransaction
object.
The GetOutcome
method retrieves the transaction outcome from the database server. The method will determine whether the transaction committed and completed or not.
GetOutcome()
This method uses the same connection string as the one used by the OracleConnection
that instantiated/returned the OracleLogicalTransaction
object.
The connection created by this method will be closed upon return.
Repeated calls of this method on the same instance will not incur any server round-trip.
This property has been deprecated in 12.1.0.2. It will be desupported in a future release.
GetOutcome(string
userid
, string
password
, string
dataSource
)
This method uses the connection information provided by the parameters to this method.
The connection created by this method will be closed upon return.
Repeated calls of this method on the same instance will not incur any server round-trip.
This property has been deprecated in 12.1.0.2. It will be desupported in a future release.
GetOutcome(string
constring
, byte[]
ltxid
, out bool?
bCommitted
, out bool?
bUserCallCompleted
)
The application can use this static method to determine the outcome if the outcome was not known when the exception was raised.
The application will need to obtain the connection string and logical transaction id
from the OracleException.OracleLogicalTransaction
object before calling this method.
The supplied connection string will be used to establish a connection to the database to determine the outcome of the provided logical transaction id.
ODP.NET implicitly calls GetOutcome
under the following conditions:
Transaction Guard is enabled on the service
OracleException is raised
The exception is a recoverable error
When all of the above is true, then the OracleException.OracleLogicalTransaction
property will be non-null.
If a connection is involved in a distributed transaction, then GetOutcome
is not called implicitly and the OracleException.OracleLogicalTransaction.LogicalTransactionId
property returns null.
Note:
Once one server round-trip is incurred for theGetOutcome()
invocation
, the PL/SQL ForceOutcome
is never invoked again against the server for a given OracleLogicalTransaction
object.