transactions

Exception handling around the rollback of a SqlTransaction

I have two stored procedures that I want execute wrapped in a transaction. For various reasons, I need to handle the transaction in my application code instead of within the database. At the moment, my code looks like this: try { using (SqlConnection conn = Connection()) { conn.Open(); using (SqlTransaction sq...

Transactionscope not working when two remote sql connections

I am using Two SQL Server connection object in my C# console application project. I need to do this in single transaction So I used Transactionscope (Distributed Transaction) I am not able to use the connection within the transactionscope It is displaying the error MSDTC on server is unavailable. How can I solve.... Both the one sql...

SSIS how to write to log table without being rolled back by a transaction failure?

When processing a batch of records, if any of them fail business rule validations the entire set of inserted data is rolled back for data integrity. During this process I need to log such errors to a table in the database - which shouldnt be rolled back when the overall transaction is. What is the best way to do this in SSIS? Different...

run code after transaction commit in Django

Is there any way to run some code after transaction commit in Django? I need to send some messages to a rabbitmq server for offline processing, but the message gets to the consumer before the Django transaction is commited. My message is sent in the post_save signal of the model. What I'm looking for is a similar mechanism, using sign...

Migrating application to use Guice - how to inject transactions into existing objects?

I'm new to Guice, and I'm working it in to an application with a large amount of legacy code. It has several classes that look like this: public final class DataAccessClass { private Transaction txn; @Inject //This was just added public DataAccessClass(/* injectable parameters */, Transaction txn) { this.txn = tx...

Unit Testing data from DB2

I have a .NET project (Test project) in VS2008 and am doing some unit tests for the data in DB2. I am finding that the tests are not transactional and I have to phyiscally go and delete the data or run a function to clean the data before I run the test even though I am using ITransaction. Can any one point why? ...

Problem with deadlock on SELECT/UPDATE

Hi. I'm having a problem with deadlock on SELECT/UPDATE on SQL Server 2008. I read answers from this thread: http://stackoverflow.com/questions/661908/sql-server-deadlocks-between-select-update-or-multiple-selects but I still don't understand why I get deadlock. I have recreated the situation in the following testcase. I have a table:...

Is Inconsistent state allowed in a transaction?

I have a very simple question about transactions. (in sql server 2000, but i guess it applies to general db. transactions). tblPrimaryKey PkId ----- 1 2 3 tblForeignKey Id ForeignKey ---- ----- 1 1 2 2 3 3 4 1 I have 2 tables, one referencing the other (tblForeingKey.ForeignKey references tblPrimaryKey.Pk...

Does CHECKPOINT work the same as COMMIT in TSQL?

I normally use fully-explicit transactions in my stored procs (BEGIN TRANSACTION .... COMMIT). I just ran across an old one that instead uses "CHECKPOINT" at certain places in the code. This won't do the same thing, right?? Even if the database is in simple mode, the whole thing will still run as one big transaction, even with a bunch o...

Handle error in SQL Trigger without failing transaction?

I've a feeling this might not be possible, but here goes... I've got a table that has an insert trigger on it. When data is inserted into this table the trigger fires and parses a long varbinary column. This trigger performs some operations on the binary data and writes several entries into a second table. What I have recently discover...

How to use multiple, nested, transactionscopes?

I am doing a few operation in linq2sql that needs to be run in a transaction. However, some of the methods I use inside of the transaction also uses linq2sql and runs inside a transaction of their own (the inner transaction is run within a stored procedure). This gives me the exception [TransactionInDoubtException: The transaction is in...

Using "GO" within a transaction

I'm building a web app that attempts to install/upgrade the database on App_Start. Part of the installation procedure is to ensure that the database has the asp.net features installed. For this I am using the System.Web.Management.SqlServices object. My intention is to do all the database work within an SQL transaction and if any of it ...

What is transaction?

Well could someone provide a really simple (but not simpler than possible) explanation of transaction as applied to computing (even if copied from Wikipedia)? ...

Transaction Processing: When does a rollback occur?

Recently this question was posted about the definition of what a transaction is in a general context. A common answer to this question was that a transaction should be an atomic unit of work My question relates to this atomicity (i think) I often see explicit calls to ROLLBACK in SQL stored procedures. Is it generally a common require...

What is the equivalent C# 3.0 Linq to SQL for this?

Old VB6 Code that needs to be converted: 'DB Connection Set Conn = New ADODB.Connection Conn.ConnectionString = sConn Conn.Open sConn Conn.BeginTrans 'Recordset Set rsPrice = New ADODB.Recordset rsPrice.CursorLocation = adUseClient rsPrice.CursorType = adOpenKeyset rsPrice.LockType = adLockBatchOptimistic rsPrice.ActiveConnection = Con...

How to check that there is transaction not yet commit in SQL server 2005?

anyone know what is the command to check un-commited transaction? ...

Controlling Jboss rollback after Hibernate exception

HI All, I am trying to save name, address, email information using Hibernate...sometimes there is an exception thrown by Hibernate, this causes JBoss to rollback the full transaction! I do not want this to happen, if there is a Hibernate exception while saving email... then I just want the email bit to rollback not the entire, name, add...

TransactionInDoubtException using System.Transactions on SQL Server 2005

The underlying question to this post is "Why would a non-promoted LTM Transaction ever be in doubt?" I'm getting System.Transactions.TransactionInDoubtException and i can't explain why. Unfortunately i cannot reproduce this issue but according to trace files it does happen. I am using SQL 2005, connecting to one database and using one ...

Castle ActiveRecord - Always updating children, why?

Dear All: Hi! These last two weeks have been my first experience with Castle ActiveRecord, and with the ActiveRecord pattern in general. I'm working on a large system that uses it frequently, and I have been finding some strange SQL transaction issues (such as the one below) as I work on it. I'll give a simplified version of the one ...

Sharing transaction scope between threads in python/django? (PostgreSQL)

Is there any way to share same transaction between two threads in a django-based code? The problem is that I have 1.1's TestCase (those that wrap individual tests into transactions) that are intended to test code that is running in a different thread [a sort of asynchronous testing]. So these test create some data that is intended to be...