transactions

database transaction

If I'm using a mysql client(eg. squirrel) to execute an update query, after 10 seconds, I cancelled the query, would there be partial update or would everything that's done be rolled back? ...

Why do updates inside of a SQL transaction still need disk IO?

In SQL Profiler you can see that very simple updates to a table by primary key take about 10-30ms each. On about every 10th update the write column shows 1, on all other updates it shows 0. This must mean that about every 10th update statement still requires disk IO. I wonder why that is. Would it not be more efficient queue up all IO un...

using construct with sqlTransaction dependent on number of different action results ...

I'm curious if following code would be considered safe? using (SqlConnection cn = new SqlClient.SqlConnection(connectionString)) { cn.Open(); using (SqlTransaction tr = cn.BeginTransaction()) { try { if (!Data.DoSomething1(tr, p1, p2)) { tr.Rollback(); return false; ...

GAE Entity Groups/Transaction

Hi, Say you have a Client Buying Card object and a product object. When the client chooses the buy opition you create the object and then add a product. It should be transactional but it's not on the same entity group as the product and the card already been persisted, isn't it? Is there any way to overcome this simple scenario safely a...

Hibernate save() and transaction rollback

Hi, In Hibernate when i save() an object in a transaction, and then i rollback it, the saved object still remains in the DB. It's strange because this issue doesn't happen with the update() or delete() method, just with save(). Here is the code i'm using: DbEntity dbEntity = getDbEntity(); HibernateUtil.beginTransaction(); Session sessi...

Having a destructor take different actions depending on whether an exception occurred

I have some code to update a database table that looks like try { db.execute("BEGIN"); // Lots of DELETE and INSERT db.execute("COMMIT"); } catch (DBException&) { db.execute("ROLLBACK"); } I'd like to wrap the transaction logic in an RAII class so I could just write { DBTransaction trans(db); // Lots of DELETE ...

EJB3 - using 2 persistence units within a transaction (Exception: Local transaction already has 1 non-XA Resource)

I am trying to use 2 persistence units within the same transaction in a JEE application deployed on Glassfish. The 2 persistence units are defined in persistence.xml, as follows: <persistence-unit name="BeachWater"> <jta-data-source>jdbc/BeachWater</jta-data-source> ... <persistence-unit name="LIMS"> <jta-data-source>jdbc/BeachWaterLIM...

How to avoid using duplicate savepoint names in nested transactions in nested stored procs?

I have a pattern that I almost always follow, where if I need to wrap up an operation in a transaction, I do this: BEGIN TRANSACTION SAVE TRANSACTION TX -- Stuff IF @error <> 0 ROLLBACK TRANSACTION TX COMMIT TRANSACTION That's served me well enough in the past, but after years of using this pattern (and copy-pasting the above c...

Does an insert made in a transaction is visible by SELECT before transaction is commited

I need a confirmation. Client 1 insert rows in a table inside a transaction. Client 2 request this table with a SELECT. If on this client isolation level is set to READ COMMITTED, can you confirm that the SELECT won't returns the rows that aren't yet committed by Client 1. Thanks ...

What sql server isolation level should I choose to prevent concurrent reads?

I have the following transaction: SQL inserts a 1 new record into a table called tbl_document SQL deletes all records matching a criteria in another table called tbl_attachment SQL inserts multiple records into the tbl_attachment Until this transaction finishes, I don't want others users to be aware of the (1) new records in tbl_docu...

Cannot enlist Synchronization. LocalTransactionCoordinator is completing or completed issue with hibernate spring transaction.

I am getting Cannot enlist Synchronization. LocalTransactionCoordinator is completing or completed exception when integrating my method is called from the portlet. I am using spring transaction management for handling all the hibernate transaction in the spring configuration file through AOP. When I run my hibernate dao method for pers...

Why do System.IO.Log SequenceNumbers have variable length?

I'm trying to use the System.IO.Log features to build a recoverable transaction system. I understand it to be implemented on top of the Common Log File System. The usual ARIES approach to write-ahead logging involves persisting log record sequence numbers in places other than the log (for example, in the header of the database page modi...

Building "isolated" and "automatically updated" caches (java.util.List) in Java.

FOR ANYONE INTERESTED: I have implemented the code for the behaviour I am looking for and open-sourced it on google-code. Get it here! pojo-mvcc -- Hi Guys, I am trying to write a framework which contains a lot of short-lived caches created from a long-living cache. These short-lived caches need to be able to return their entier conte...

close fails on database connections (managed connection cleanup fails) in websphere 7 but not in websphere 6.1

I have a simple method (used in a web application through servlets) that gets a connection from a JNDI name and issues a select statement (get connection, issue select, return result, close the connection etc. in finally). Due to other methods in the application the connection is set as autocommit=false. This method works normally in web...

Sending emails in web applications

Hi everyone, I'm looking for some opinions here, I'm building a web application which has the fairly standard functionality of: Register for an account by filling out a form and submitting it. Receive an email with a confirmation code link Click the link to confirm the new account and log in When you send emails from your web applic...

How to automate disbursement of electronic payments from one bank account to 20,000 other bank accounts?

I am helping a startup business to launch and I will be building or finding a shopping cart software for its website. There will only be one product for sale, but anytime someone buys a product, I have to use customer information like their zipcode and which distributor they bought from to calculate commissions that will go to the differ...

How does SQL Server treat statements inside stored procedures with respect to transactions?

Hi All! Say I have a stored procedure consisting of several separate SELECT, INSERT, UPDATE and DELETE statements. There is no explicit BEGIN TRANS / COMMIT TRANS / ROLLBACK TRANS logic. How will SQL Server handle this stored procedure transaction-wise? Will there be an implicit connection for each statement? Or will there be one tran...

ASP MVC LINQ to SQLtransaction rollback

I know that LINQ to SQL automatically wraps all changes in a database transaction. So if I wanted to use the returned ID for another insert (my user table has an AddressID, so I add a new Address record and then add a new user record with that ID) and there was a problem inserting a user, the address insert would not roll back. Should yo...

question about MySQL transaction and trigger

I quickly browsed MySQL manual but didn't find the exact information about my question. Here is my question: if I have a InnoDB table A with two triggers triggered by 'AFTER INSERT ON A' and 'AFTER UPDATE ON A'. More specifically, For example: one trigger is defined as: CREATE TRIGGER test_trigger AFTER INSERT ON A FOR EACH ROW...

Preview result of update/insert query without comitting changes to database in MySQL?

I am writing a script to import CSV files into existing tables within my database. I decided to do the insert/update operations myself using PHP and INSERT/UPDATE statements, and not use MySQL's LOAD INFILE command, I have good reasons for this. What I would like to do is emulate the insert/update operations and display the results to t...