transactions

How to rollback in EF4 for Unit Test TearDown?

In my research about rolling back transactions in EF4, it seems everybody refers to this blog post or offers a similar explanation. In my scenario, I'm wanting to do this in a unit testing scenario where I want to rollback practically everything I do within my unit testing context to keep from updating the data in the database (yeah, we'...

How to prevent "Local transaction already has 1 non-XA Resource" exception?

Hi, I'm using 2 PU in stateless EJB and each of them is invoked on one method: @PersistenceContext(unitName="PU") private EntityManager em; @PersistenceContext(unitName="PU2") private EntityManager em2; @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW ) public void getCandidates(final Integer eventId) throws ControllerExcept...

How Can I Find What's Causing My Transaction to Get Promoted?

I have web site which serves web services (a mixture of .asmx and WCF) which is mostly using LINQ to SQL and System.Transactions. Occaisionally we see the transaction get promoted to a distributed transaction which causes problems because our web servers are isolated from our databases in such a way that it is not possible for us to use ...

File System Transactions using .NET on WinXP

I'm using WinXP on clients and Win2003 on a server. I need do atomic actions: create-moving files, insert-update database. Are there any good practices for file system transactions using WinXP? I know in Vista/Win2008/Win7 there are TxF transaction (NTFS) but not in WinXP. I don't want use COM+, neither other complex solutions. Only n...

Handling transaction context using method attribute in linq to sql

Is there a way to just put an attribute to a method so that the whole code in the method is executed in a transaction scope? I've seen this done in sharp architecture but I'm using Linq to sql not nhibernate. Thanks! This what I would like to do: [Transaction] public void InsertCustomer(Customer customer) { //insert customer } So th...

Does rails do a rollback if I use begin...rescue?

I'd like to add a begin...rescue block to one of my controllers create method, in order to log better info and construct the correct error message to return to the client. Does the rescue in any way 'interrupt' the rollback process? I'm assuming rails automatically does a rollback. When does it happen? Has it already happened by the t...

Nested Transaction issues within custom Windows Service

I have a custom Windows Service I recently upgraded to use TransactionScope for nested transactions. It worked fine locally on my old dev machine (XP sp3) and on a test server (Server 2003). However, it fails on my new Windows 7 machine as well as on 2008 Server. It was targeting 2.0 framework; I tried targeting 3.5 instead, but it still...

TransactionScope and Transactions

In my C# code I am using TransactionScope because I was told not to rely that my sql programmers will always use transactions and we are responsible and yada yada. Having said that It looks like TransactionScope object Rolls back before the SqlTransaction? Is that possible and if so what is the correct methodology for wrapping a Tran...

Oracle transaction read-consistency ?

I have a problem understanding read consistency in database (Oracle). Suppose I am manager of a bank . A customer has got a lock (which I don't know) and is doing some updating. Now after he has got a lock I am viewing their account information and trying to do some thing on it. But because of read consistency I will see the data as ...

Do we need Record Level Locking when we already have Transaction for online ordering? (of concert ticket or airline booking)

For online ordering of concert seats or airline tickets, do we need Record Level Locking or is Transaction good enough? For concert ticket (say, seat Number 20B), or airline ticket (even with overbooking, the limit is 210, for example), I think the website cannot lock any record or begin transaction when showing the ticket purchase scre...

PHP + MySQL transactions examples

I really haven't found normal example of PHP file where MySQL transactions are being used. Can you show me simple example of that? And one more question. I've already done a lot of programming and didn't use transactions. Can I put a PHP function or something in header.php that if one mysql_query fails, then the others fail too? ...

A new method of supporting FOSS?

I have been kicking an idea around for sometime and wondered if something of it's nature hadn't already been invented. The premise is a website that integrates code management, project/team management, and micro-transactions. Donations, in and of themselves, are a sporadic, and unreliable method of supporting developers. Furthermore mo...

Transaction within IF THEN ELSE doesn't commit

In my TSQL script I have an IF THEN ELSE structure that checks if a column already exists. If not it creates the column and updates it. IF NOT EXISTS( SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'tableName' AND COLUMN_NAME = 'columnName')) BEGIN BEGIN TRANSACTION ALTER TABLE tableName ADD colu...

Two Phase Commit with MongoDB

Heres what Im thinking. Do you see any issues with this workaround to emulate 2 phase commit when using something like MongoDB where each operation is atomic and there is no support for transactions outside of that? transaction_scope: read message from servicebus - UpdateCustomerAddress get customer aggregate from docdb, repl...

Message driven bean not responding until client method is complete

Hi, I have a MDB deployed on Jboss 4.2.2 and a client on the same server that produces messages and expects a reply from the MDB via a temporary queue created before the message is sent. When I run the client, I see that it creates the message, puts it in the queue and waits for the reply (no problem so far) ... but when I check in the...

How transaction level isolation affects performace in autocommit mode in MySQL?

Hello. I have a VBulletin 4.x forum running on my server. Some forum tables were converted into InnoDB for performance reasons according to this instruction. Forum itself does not use transactions (no START TRANSACTION or BEGIN WORK in source code) at all and InnoDB tables are used just to prevent tables from locking on UPDATE queries. ...

mysql innodb max size of transaction

Using mysql 5.1.41 and innodb I'm doing some data import, but can't use load data infile, so I'm manually issuing insert statements. I found that it's much faster to disable auto commit and issue say, 100 insert statements and then commit, instead of the implicit commit after each insert. It got me thinking, what limits are there to ho...

Transactional isolation level needed for safely incrementing ids

I'm writing a small piece of software that is to insert records into a database used by a commercial application. The unique primary keys (ids) in the relevant table(s) are sequential, but does not seem to be set to "auto increment". Thus, I assume, I will have to find the largest id, increment it and use that value for the record I'm in...

SQL Server SPID and transaction scope

We are running several calls against a SQL Server database within a transaction scope using entity framework. Are we right is assuming that the SPID will be held for the duration of the transaction and that all calls will be made on the same SPID? ...

SQL Server BEGIN/END vs BEGIN TRANS/COMMIT/ROLLBACK

I have been trying to find info on the web about the differences between these statements, and it seems to me they are identical but I can't find confirmation of that or any kind of comparison between the two. What is the difference between doing this: BEGIN -- Some update, insert, set statements END and doing this BEGIN TRANS ...