Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

DotConnect for Oracle getting started Guide (6): using transactions

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Download dotConnect for Oracle Latest Version

dotConnect for Oracle(formerly OraDirect. NET) builds on ADO. NET technology to provide a complete solution for Oracle database-based applications. It brings a new approach to designing application structures, improves work efficiency, and makes database application development easier.

use transactions

understand affairs

local transaction

Distributed Transaction in OCI Mode

Distributed transactions in direct mode

understand affairs

A transaction is one or more operations that are treated as a single unit of work, complete or invalid ("all or none"). If a failure occurs at some point in the transaction, all updates can be rolled back to their pre-transaction state. Transactions must conform to ACID attributes-atomicity, consistency, isolation, and persistence-to ensure data consistency.

Explicit transactions in PL/SQL generally perform better if a transaction involves multiple tables in the same database. You can use Commit and Rollback statements in SQL to repair and discard previous commands in the current PL/SQL block, respectively.

Otherwise, transactions with plain SQL can be implemented by designing special command classes in libraries/assemblies for Oracle databases. For example, you can use devart.data.oracle.oraclecommand: to start a transaction on a connection to an oraclecommand, execute multiple SQL statements through this oraclecommand, and commit/rollback all operations if necessary. See examples in the topic Local Transactions.

This article describes how transactions can be manipulated from. NET code that does not contain envolving PL/SQL transactions--the most common scenario for processing transactions. For your task, you can choose the type of transaction you want to implement-local or distributed. A transaction is considered local when it is a single-phase transaction and is processed directly by the database. A distributed transaction is a transaction that affects multiple resources, is coordinated by a transaction monitor, and uses fail-safe mechanisms such as two-phase commit to resolve the transaction.

Note: Oracle does not support scalable transactions as used in SQL Server, and the implementation of distributed transactions differs between OCI and Direct modes. Also take into account that TransactionScope is only done when processing.

local transaction

dotConnect for Oracle has OracleTransaction objects for performing local transactions. OracleTransaction is used when multiple operations on a connection object should be performed as a single transaction. An application creates an OracleTransaction object by calling BeginTransaction on an OracleConnection object. All subsequent operations associated with the transaction (for example, commit or abort the transaction) are performed on the OracleTransaction object. The correlation between OracleConnection and OracleTransaction is always 1:1. Therefore, only one OracleTransaction can be created at a time for a single OracleConnection.

Examples:

The following example creates OracleConnection and OracleTransaction. It also demonstrates how to use the BeginTransaction, Commit, and Rollback methods.

1

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report