transactions

Can I get a reference to a pending transaction from a SqlConnection object?

Hey, Suppose someone (other than me) writes the following code and compiles it into an assembly: using (SqlConnection conn = new SqlConnection(connString)) { conn.Open(); using (var transaction = conn.BeginTransaction()) { /* Update something in the database */ /* Then call any registered OnUpdate handlers */ ...

Transaction Scope

How does the transaction scope work? How does it know when there is another context being used already and how might I implement another kind of scope in my code. I'm primarily a vb.net developer but I can read the c# if you write in that. In case the above was too vague: I understand what system.transactions does and how to use it. ...

Difference between DBEngine.BeginTrans and DBEngine.Workspaces(0).BeginTrans

In Access, what is the difference between these two statements? DBEngine.BeginTrans and DBEngine.Workspaces(0).BeginTrans The documentation for both leads to the same place. ...

Can I reuse a Transaction? and how?

I must use a corporate class that re-uses or re-creates a transaction after every Commit() or Rollback(). This class is told to use (or not use) transactions via a Boolean ctor parameter. I am thinking of wrapping this API to separate the transaction support (to rely explicitly on Transaction objects or the ambient TransactionScope). Bu...

EJB Transactions in local method-calls

In the following setup, does method B run in a (new) transaction? An EJB, having two methods, method A and method B public class MyEJB implements SessionBean public void methodA() { doImportantStuff(); methodB(); doMoreImportantStuff(); } public void methodB() { doDatabaseThing(); } } The ...

Grails, Inserting lots of data using withTransaction results in OutOfMemoryError

I'm using Grails 1.1 beta2. I need to import a large amount of data into my Grails application. If I repeatedly instantiate a grails domain class and then save it, the performance is unacceptably slow. Take for example importing people from a phone book: for (each person in legacy phone book) { // Construct new Grails domain class f...

Transaction rollback and web services

Given an example of calling two web services methods from a session bean, what if an exception is thrown between the calls to two methods? In the case of not calling the web services the transaction will rollback and no harm done. However, the web service will not rollback. Of course, even with a single web service there is a problem. Wh...

Rails testing with out-of-process database access?

I'm building a Rails application that requires some models to interact with some necessary Java libraries. To do this, I want to use Rails on on MRI - not JRuby or RBJ. The Java code only needs read access to the database tables managed by the Rails app. One way to do this is to set up a Servlet that reads the Rails app's database table...

Undo in a transactional database

I do not know how to implement undo property of user-friendly interfaces using a transactional database. On one hand it is advisable that the user has multilevel (infinite) undoing possibility as it is stated here in the answer. Patterns that may help in this problem are Memento or Command. However, using a complex database including ...

com.ibm.websphere.jtaextensions.NotSupportedException thrown under load

Hi All, I have an application containing 4 MDB's each of which receives SOAP messages over JMS from MQ. Once the messages have been received we process the XML into an object model and process accordingly which always involves either loading or saving messages to an Oracle database via Hibernate. Additionally we have a quartz process w...

SQL Server 2005: Transaction Deadlock

Hi ppl, I am getting this error very frequently but not consistently on 2 pages in an application which is in a production environment. I just have some screen shots of the error below. Transaction(Process ID XX) was deadlocked on lock | communication buffer resources with another process and has been chosen as a deadlock victim. Reru...

How can I use transactions that span procedures chained across multiple servers?

I'm trying to test a proposition that one of our vendors presented to us for accessing their product database and it regards to queries and transactions that span multiple servers. I've never done this directly on the database before and to be frank, I'm clueless, so I'm trying to mock up a proof that this works at least conceptually. ...

MySQL AUTO_INCREMENT does not ROLLBACK

I'm using MySQL's AUTO_INCREMENT field and InnoDB to support transactions. I noticed when I rollback the transaction, the AUTO_INCREMENT field is not rollbacked? I found out that it was designed this way but are there any workarounds to this? ...

Object-level transaction management pattern

I'm trying to find out the best way to handle transactions at object level (not database level). Short example: 4 objects A, B, C and D. A starts a transaction and calls methods in B and C. Whithin this transaction C is also calling D. The methods being called aren't supposed to always participate in this transaction, but can be called a...

How do I configure authentication between linked servers?

I am trying to test a proof of concept that I can run a distributed transaction across two linked SQL Servers, linked using sp_addlinkedserver - their names are Server1 and Server2, both running under default instances. Each server holds a single database, Source and Destination respectively and the destination database holds a single t...

Entity Framework: Using transactions and rollbacks... Possible?

Issue: (With Sql 2005) How can I query the database while the transaction is up? (Since it locks the table) How can cause a transaction to rollback and then close itself to allow the table to be queried? So I found this much: [TestMethod] public void CreateUser() { TransactionScope transactionScope = new TransactionScope(); ...

When inserting rows into MS Access from c# using TransactionLevel.ReadUncommitted from a prepared statement, the ordering seems off

I have some code in c# that is writing information (row by row) into an access database using prepared statements. I am using OleDb, and a TransactionLevel.ReadUncommitted because sometimes I need to look at the data before committing it. The problem seems to be that on 1 out of 7 different tables, the ordering that I retrieve the reco...

C#, Winforms & LINQ to SQL.. Datacontext lifecycle?

We use an enterprise framework that we wrote to facilitate all sorts of company specific stuff that we do. Within the framework, we provide a LINQ to SQL ORM to use when appropriate. All of this is based on the Microsoft MVC framework. On the MVC side, we new up a datacontext in our base controller. This allows us a full datacontext lif...

Transaction for .net operations

I have to perform 3 operations in a windows app as a Transaction. These are not SQL operation otherwise i'd have used TransactionScope. The first operation is to log some value in a db, 2nd is to move an e mail to a pst and 3rd one is to move email to another mailbox. If any if these operation fails,I want other operations to roll back t...

Are Transactions allowed by default in SQLServer?

I need to use DbTransactions (on a single db) but I am not sure about how to make sure it will keep working when I deploy to the production environment. What are the requirements for an application to be able to use SQL DbTransactions? Are they allowed by default in SQLServer (and what's the deal with MSDTC)? ...