transactions

SQL Server and TransactionScope (with MSDTC): Sporadically can't get connection

I've written some tests for .net code that invokes calls to my SQL Server. It appears that using System.Transactions is an excellent choice for rolling back any modifications to the database that result. I'm aware that some purists would suggest that I might want to mock the database, but I'm not going down that road; this is not stric...

transaction question in SQL Server 2008

I am using SQL Server 2008 Enterprise. And using ADO.Net + C# + .Net 3.5 + ASP.Net as client to access database. When I access SQL Server 2008 tables, I always invoke stored procedure from my C# + ADO.Net code. My question is, if I do not have any transaction control (I mean begin/end transaction) from my client C# + ADO.Net code, and I...

How long until MySQL transaction times out

How long can a MySQL transaction last until it times out? I'm asking because I'm planning to code an payment process for my e-commerce project somewhere along the lines of this (PHP/MySQL psuedo-code): START TRANSACTION; SELECT...WHERE id IN (1,2,3) AND available = 1 FOR UPDATE; //lock rows where "available" is true //Do payment proce...

Batch update returned unexpected row count from update

I have the following relationship: // In A.java class @OneToMany(mappedBy="a", fetch=FetchType.LAZY) @Cascade(CascadeType.SAVE_UPDATE) private List<B> bList; // In B.java class @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="id_a") @Cascade(CascadeType.SAVE_UPDATE) private A a; I get this exception: StaleStateException: Batch upd...

Java: Difference betwen UserTransaction and EntityTransaction

Title says it all: What is the difference between a UserTransaction and a EntityTransaction? My rudimentary understanding is that UserTransaction is used when JTA is required (e.g. to do queries on mulitple things), and that EntityTransaction is used when JPA only is required (e.g. when the query is atomic). Is that the only difference...

can transaction be rolled back after its commited and connection is closed

finally { // Commit the transaction. sqlTran.Commit(); reader.Close(); reader.Dispose(); conn.Close(); conn.Dispose(); } i would like to give the user an option of opps! roll it back so its commited can it be rolled back? ...

How to do a transactional get from Websphere MQ in dotnet?

I’m writing a client that receives messages from an external Websphere MQ Queue and puts them on an internal MSMQ Queue. The client will use MQ Client or, preferably, be purely managed (MQC.TRANSPORT_MQSERIES_MANAGED). Based on an example from IBM, I have a version up and running that can do a simple IBM.WMQ.MQQueue.Get(…). How can this...

What is the best way to rollback a .net transaction?

This question is related to my question: http://stackoverflow.com/questions/3072986/sql-server-and-transactionscope-with-msdtc-sporadically-cant-get-connection I'm doing some transaction programming using the .net TransactionScope class. If I understand correctly, I can do some SQL operations within a transaction by wrapping the SQL ca...

PHP script aborts, causes MySQL transaction to fail, whole app locks for a little while

I'm using transactions in a MySQL database, along with Ajax, and I'm having some troubles with scripts timing out. So, here's a rundown of what happens: Ajax script on page makes request to server. Server receives request; script starts a MySQL transaction. Ajax script is set to timeout after two seconds; times out; tells server to abo...

Application Transaction + C# + more than one operation

Hello, I would Like to ask you, if there is a way to set some operations into transaction. I have problem such like this: 1) Generate File from data from database 2) Encrypt it 3) Send to server I would like do it in one transaction. Any failured step 1-3 should cause the cancelling transaction. Best regards, ...

Can MySql rollback a sql transaction over multiple tables?

I have searched the MySql documentation and found nothing. I have tried this ... the Rollback doesn't seem to cancel the inserts made in table1 and table2 Start Transaction; INSERT INTO Table1(field1,field2) VALUES (value1, value2); INSERT INTO Table2(field3,field4) VALUES (value3, value4); INSERT INTO Table3(field5,field6) VALUES (...

When will automatic rollbacks be executed in PHP executing Oracle PL/SQL - OCI8?

I have PHP code that execute a stored procedure 10 times. If one stored procedure call fails, it should continue on, and at the end commit the transaction. It basically looks like this: $connection = getConn(); foreach($row as $i=>$j) { $SQL = "BEGIN MYPROC.EXECUTE(:VAL1, :VAL2); END;"; $statement = OCIParse($connection, $SQL); ...

What's the point to enclose select statements in a transaction?

Hi guys, What's the point to enclose select statements in a transaction? I think select statements are just "GET" data from the database, they don't have chance to rollback something, because you just can't change the data. So, does that to say we never need put select statements in a transaction? Am I right? Thanks. ...

SQL Server transactions: insert causes locks?

I'm having the following issue: I'm inserting a row to table (say, 'temp') inside a transaction (default ADO.NET transaction). Until that transaction is committed, the command 'select * from temp', running from another session (SQL Server 2008 management studio), is blocked and cannot be completed. This seems weird to me. Shouldn't the...

Configuration alternative to Spring @Transactional

Is there any configuration based alternative to the @Transactional annotation in Spring? I want to keep my java classes as free from Spring as possible, i.e. as decoupled as possible from any framework. ...

How do you wrap a circular reference operation in a single transaction using Entity Framework 4?

I have a table of Persons and a table of Things, where each Thing is owned by a Person and each Person has a FavoriteThing. Persons PersonID int <PK> FavoriteThingID int <FK> Things ThingID int <PK> PersonID int <FK> I would like to be able to add a Person and his/her favorite Thing, as well as setting that Thing's Person...

PDO, mysql, transactions and table locking

For fun I am replacing the mysqli extension in my app with PDO. Once in awhile I need to use transactions + table locking. In these situations, according to the mysql manual, the syntax needs to be a bit different. Instead of calling START TRANSACTION, you do it like so... SET autocommit=0; LOCK TABLES t1 WRITE, t2 READ, ...; ... do ...

File+database transaction safety

I have a MySQL table which basically serves as a file index. The primary key of each record is also the name of a file in a directory on my web host. When the user wants to delete a file from the system, I want to ensure some kind of transaction safety, i.e. if something goes wrong while deleting the file the record is not erased, and i...

Get a resultset from a mysql transaction

Hello I was wondering if it's possible to get the resultset of the select query from my transaction. Mysql returns that the table was updated, but returned 0 rows. This is the transaction: START TRANSACTION; SELECT *, @A:=id FROM mailer_log LIMIT 0,10; UPDATE mailer_log SET picked=1 WHERE id=@A; COMMIT; ...

Can i have both ISession and IStatelessSession side by side?

Hello all, Consider a transaction-per-view model where with an IHttpModule i open a transaction using a standard ISession. Now, i have a page where i want to do some batch operations. Since IStatelessSession is preferred for batch operations: Can i have both ISession and IStatelessSession open at the same time? Is it safe? If 1. yes...