transactions

Why does creating a table with a foreign key constraint in one transaction block access to the referenced table in another?

In one transaction I am creating a table which references another table. In a second transaction, I run a SELECT-query against the referenced table but it is blocked by the first transaction. Why is that? Transaction A: BEGIN TRAN CREATE TABLE Child (id int NOT NULL, parentId int NOT NULL REFERENCES Parent (id)); ...

Enterprise Library Data Access Block Transaction Management Best Practice

What is the best practice for processing a batched series of CRUD operations in a single transaction with the Enterprise Library Data Access Block that it won't be esclated to a distributed transaction? Edit Full Source: public void BatchInsertEvents(IList<EventItem> events) { _dataAccessBase = new DataAccessBase("[dbo].[EventInser...

Where exactly is the JTA Transaction demarcation for CMT respected?

I'm trying to fully understand the JTA demarcation with CMT. The behavior I am experiencing is that only the first @TransactionAttribute of the method is respected on the EJB and subsequent method invocations of the same bean with different @TransactionAttribute annotations are not. Example: @Stateless @TransactionAttribute(Transact...

What happens to an uncommitted transaction when the connection is closed?

Are they rolled back immediately? Are they rolled back after some period of time? Are they left in an uncommitted state? Is the behavior the same if connection pooling is used and the connections are simply reset? ...

Ensuring unique numbers from a sql server database

I have an application that uses incident numbers (amongst other types of numbers). These numbers are stored in a table called "Number_Setup", which contains the current value of the counter. When the app generates a new incident, it number_setup table and gets the required number counter row (counters can be reset daily, weekly, etc ...

Transaction with two sql insert

I have two sql insert to do (say for examples in tables A and B), they are in a transaction because I want the database to remain consistent, that is, a tuple in A must have references in B. In the second insert I need the id that comes from the first, but I don't get this id until I make a commit on the transaction. So I'm stuck. I do...

How do I keep an OleDbConnection from trying to enlist in a distributed transaction?

I am using OleDB to connect to an excel file using this connection string @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0 Xml;HDR=YES""" But when I do this (which is inside a TransactionScope()) using (OleDbConnection conn = new OleDbConnection(connectionString)) { conn.Open(); ... } I g...

Transaction Processing Using PHP and MySQL

Hi, I'm trying to implement two-phase commit using PHP and MySQL, and coming up short. The main block I've found is that I'm unable to store the MySQL connection resource in a place where I can find it again for the second phase. Is it possible to serialize a database handle? Here's the case I'm trying to code for: User sends data Se...

Microsoft SSIS 2005. Can't Use Transactions

I have set the package TransactionOption to Required and DataFlowTask's TransactionOption to Supported, but when I execute the package, I get an exception: [ADO NET Destination [82]] Error: The transaction has already been implicitly or explicitly committed or aborted Why does this happen, and how can I fix it? ...

Common-practice in dealing with high-load tables in MySQL

Hi, I have a table in MySQL 5 (InnoDB) that is used as a daemon Processing Queue, thus it is being accessed very often. It is typical to have around 250 000 records inserted per day. When I select records to be processed, they are read using a FOR UPDATE query to eliminate race conditions (everything is Transaction Based). Now I am dev...

MySQL Deadlock Detection via PHP

What is the best-practice in dealing with MySQL Dead-Locks in PHP? Should I wrap all database calls in a try{}catch{} block and look for the DeadLock error code from the database? Do I then reissue the whole transaction again (I presume the one that failes rolled back)? ...

TransactionScope random error in debug mode

I get following error randomly when executing code from debug mode. Cannot access a disposed object. Object name: 'SqlDelegatedTransaction'. Error is being thrown after few commands have been executed instantly, not an timeout issue I have just one transaction, opened with using(var scope = new TransactionScope(TransactionOption.Re...

Extending a WCF Service Reference to a WSDL to implement IEnlistmentNotification

I have a WCF Service Reference to a WSDL file for a credit card processing web service (Cybersource). I'd like to somehow extend the generated service reference client to implement IEnlistmentNotification as to support transactional processing. I am familiar with implementing the IEnlistmentNotification interface, but I can't find a go...

Atomicity of Data Adapter in ADO.NET

Hi, I am new to ADO.NET and learning it. I was wondering if Data Adapter in ADO.NET provides atomicity or ACID properties by itself when filling the Data Set and updating the Database or do we have to use transaction explicitly to achieve this. Lets say, I want to fetch data from the Database through the Data Adapter to a Data Set Se...

Autocommit vs. Single Transactions (Small Project vs. Big Project)

Hi there, I am currently working on a very specialized PHP framework, which might have to handle large database transfers. For example: Take half of the whole user count; this should be every day's workspace for the framework. So, if my framework is required by big projects, is it recommend to use single transactions with multiple qu...

.NET TransactionScope rollback order

Apparently (because the documentation doesn't say any word of this), in a .NET Transaction (using TransactionScope), the rollbacks are done in the same order as the commits would be, and in the same order as the registrations were done. Logically, rollback should be in reverse order: If an action sequence is "do A" then "do B", my rollb...

PHP: SQL Prepared statement transaction not working correctly. It's inserting 1 SQL statement, not both.

I'm finding that the PDO Transaction is only commiting 1 of my 2 SQL statement. For some reason, my PHP script is not inserting into my MySQL database 'homes' table BUT it does insert into the 'invoices' table - even though I'm using a PHP PDO database transaction. Code below: $conn_str = DB . ':host=' . DB_HOST . ';dbname=' . DB_NAME;...

NHibernate transactions randomly not rolled back

I have a suite of integration tests that run inside transactions. Sometimes it seems that NHibernate transactions are not being correctly rolled back. I can't work out what causes this. Here is a slightly simplified overview of the base class that these integration test fixtures run with: public class IntegrationTestFixture { priva...

confusion about transactions and msdtc

I have some basic confusion about how transactions and msdtc work together. I have a basic server/client winforms app. The app uses transactionscope to encapsulate several sql commands that are executed on the sql server. The app seemed to work fine when I enabled msdtc network access on the server only. Then one day it stopped working...

Can SubSonic's SimpleRepository enlist in a transaction for two different object types?

I've been exploring Sub Sonic 3's SimpleRepository and have been pretty happy with it but have a question regarding transactions. I am aware that using methods like 'AddMany' and 'DeleteMany' will automatically perform all of those operations within a single transaction, but was wondering if it's possible to force the SimpleRepository to...