transactions

Best options for implementing my own Transaction provider

I'm using a remote 3rd party storage solution that does not have support for transactions. I want to implement my own pseudo-ACIDity in .NET for this solution by simply attempting to rewrite/delete non-failing Entity inserts/update to get to an old-data-but-good-data state when other inserts/updates fail inside a transaction context. I...

Would you use AOP for database transaction management?

A while back I wrote an application which used Spring AOP for defining which methods were transactional. I am now having second thoughts as to how much of a great idea this was; I have been hit a few times after a minor refactor (changing method signatures etc), which of course doesn't become apparent until something actually goes wrong ...

Unit Testing the Use of TransactionScope

The preamble: I have designed a strongly interfaced and fully mockable data layer class that expects the business layer to create a TransactionScope when multiple calls should be included in a single transaction. The problem: I would like to unit test that my business layer makes use of a TransactionScope object when I expect it to. ...

Why does calling full text search in SQL Server 2008 fail when inside transaction scope?

The following code: var foo = Users.Join( tvf_SearchUsers(queryString), u => u.User_Id, s => s.User_Id, (u, s) => u); Selects users that match the query string based on a table valued function (tvf_SearchUsers), which utilises full text search. This code snippet is part o...

transaction timeout not working on hibernate with oracle

I am having problem setting the transaction timeout for hibernate on oracle. It does not work.Can anyone help? The "SaveOrUpdate" will not return within the stated 10 seconds. It will hang for a very long time. I am using Oracle 10r2. Hibernate Configuration File oracle.jdbc.driver.OracleDriver jdbc:oracle:thin:@9.9.9.9:1521...

Transaction in LLBLGen Pro

I am using LLBLGen Pro 2.5 with self-servicing. If I want to add some rows into my tables within a transaction and then update the first row I added, do I have to add that first entity into the transaction object again? Here is a fictional example of what I mean: Dim objCustomer as New CustomerEntity() Dim trans as new Transaction(Iso...

Will a using statement rollback a database transaction if an error occurs?

I've got an IDbTransaction in a using statement but I'm unsure if it will be rolled back if an exception is thrown in a using statement. I know that a using statement will enforce the calling of Dispose()...but does anyone know if the same is true for Rollback()? Update: Also, do I need to call Commit() explicitly as I have below or wil...

How to detect deadlocks in Mysql / innodb ?

Hi, I know that deadlocks occur inevitably when using transactions in Innodb and that they are harmless if they are treated properly by the application code - "just try it again", as the manual says. So I was wondering - how do you detect deadlocks? Does a deadlock issue some special mysql error number? I am using PHP's mysqli extensio...

EF insert related objects

Hi, I am using silverlight client with ado.net dataservices on entity framework. I have an Entity Contact and an Entity Address which is related with a foreign key relation ship... A contact can have 1 or more Adresses but a Address needs always at least 1 contact.. pretty basic... I have a Repository for my contacts and Address which...

Are SQL Server 2000+ transactions connection dependent?

Case 1: I start a connection to the DB I BEGIN a TRANSACTION I close the connection What happens to the transaction? Case 2: I start a connection to the DB I BEGIN a TRANSACTION I start a concurrent connection to the same DB With the second connection I modify the contents of a table With the first connection I ROLLBACK the TR...

Can you have multiple MySqlCommand's in a single transaction?

I want to do an insert and an update on 2 separate tables, but have them be in 1 transaction). Essentially in pseudocode I want to do something like: MySqlTransaction trans = null; try { _Connection.Open(); trans = _Connection.BeginTransaction(); insertCmd.Transaction = trans; updateCmd.Transaction = trans; Int32 i...

How to implement Snapshot Isolation correctly and tempdb issues?

The Snapshot Isolation feature helps us to solve the problem where readers lock out writers on high volume sites. It does so by versioning rows using tempdb in SqlServer. My question is to correctly implement this Snapshot Isolation feature, is it just a matter of executing the following on my SqlServer ALTER DATABASE MyDatabase SET A...

Transaction implementation for a simple file.

Hello, I'm a part of a team writing an application for embedded systems. The application often suffers from data corruption caused by power shortage. I thought that implementing some kind of transactions would stop this from happening. One scenario would include copying the area of a file before writing to some additional storage (trans...

Using TransactionScope in a EnterpriseServices ditributed transaction

Hi, I have a ServicedComponent to a distributed transaction. Within this class a I have a method SyncRow and I am opening a new Sql connection wrapped in a TransactionScope. I am calling a sql stored proc to update data. But I am getting a Timeout on the statement objCmd.ExecuteNonQuery. Any ideas why? Public Function SyncRow(ByVal ...

How to do PayPal/Google Checkout in an Auction style web application?

I'm curious if there is a way to process/connect buyers and sellers on my site without the site having to charge the buyer and credit the seller. In other words, I don't want to touch the money, but I do want to integrate the process as much as possible on my site. I guess what I'm asking is how do auction sites manage the transactions...

Right way to use MySQL to assign tasks to worker processes

I have a huge list of URLs in a MySQL InnoDB table, and worker processes that query MySQL for a set of URLs to process. The URLs should immediately be marked as being processed, so that other worker processes do not waste resources by starting to process the same ones. Currently I first do this to get some URLs: SELECT DISTINCT url FRO...

SQL Server Batch Error Handling Problem.

How do I get this batch of SQL to get to the RollBack Transaction part at the end? SQL just stops halts script execution on the bad line of code. I know I can use a try/catch construct but i'm more interested in how this was this handled before SQL added try/catch. BEGIN TRAN CREATE TABLE TempTable (c1 INT NULL) INSERT INTO TempTable ...

TransactionScope and multi-threading

Hi, I was wondering how you would use the TransactionScope class in the correct way when you are dealing with multithreading? We create a new scope in our main thread and then we spawn of a couple of worker threads and we want these to participate in the main scope, so that for example the rollback is called on each worker if the scope...

EJB3 - handling RollBackExceptions

Hi all, I have an EJB3 application which consists of some EJB's for accessing a DB, and exposed via a Session Bean as a web service. Now there are two things I need to find out: 1) Is there any way I can stop SQL exceptions from causing the web service from throwing a SOAP Fault? The transactions are handled by the container, and curr...

How should I go about implementing an "autonumber" field in SQL Server 2005?

I'm aware of IDENTITY fields but I have a feeling that I couldn't use one to solve my problem. Let's say I have multiple clients. Each client has multiple orders. Each client needs to have their orders numbered sequentially, specific to them. Example table structure: Orders: OrderID | ClientID | ClientOrderID | etc... Some example...