One of my co-workers has a stored procedure that does the following
Begin tran
1) Dynamically generate a select statement.
2) Insert into table x
3) Execute the select statement
End tran
If this stored procedure is ran by two septate threads simultaneously, he gets the following error:
System.Data.SqlClient.SqlException: Transaction ...
I'm using CMT in EJB3 state-less session beans. Also I've created my own Exception having the annotation "@ApplicationException (rollback=true)".
Do I have to use "context.setRollbackOnly()" when I want to rollback the transaction?
Can I just rollback the transaction by throwing an exception inside public method in the bean?
If so (the...
Hi,
Does RabbitMQ support a scenario where a received message acknowledgement is sent on the DB transaction commit?
Currently we send ack after DB transaction commit. If service fails inbetween, we'll get data duplication - service will get the same message again.
Is there a pattern for this problem?
Thanks!
...
Is it worth using System.Transactions.TransactionScope on Linq to Entities?
On the MS documentation, it says that SQL calls within ObjectContext.SaveChanges() are all rolled into one transaction internally.
We have 1 database connection, that is a local SQLite database on the file system. We just want to make sure all our operations t...
Have you any problems using it on high concurrency environment? It's really works as advertised by MS? I'm using SQL Server 2005 and would like to hear the experiences of those who are/was using it on applications using it on production.
Snapshot isolation per se is not new for me as I develop/administer Firebird/Interbase as well - whe...
try
{
$con->beginTransaction();
$this->doSave($con);
$con->commit();
}
catch (Exception $e)
{
$con->rollBack();
throw $e;
}
The code above is quite standard an approach to deal with transactions,
but my question is:what if $con->rollBack() also fails?
It may cause db lock,right?If so,what's the perfect way to go?
...
I am doing a bulk insert of records into a database from a log file. Occasionally (~1 row out of every thousand) one of the rows violates the primary key and causes the transaction to fail. Currently, the user has to manually go through the file that caused the failure and remove the offending row before attempting to re-import. Given th...
This problem is not readily reproducible in a simple example here but was wondering if anyone has any experience and tips, here is the issue:
using Entity Framework
have many points in application where (1) data is written to some entity table e.g. Customer, (2) data is written to history table
both of these actions use Entity Framewo...
hi, I have some C#/ado.net code which acts differently with SQL Server 2000 and SQL Server 2008.
SqlConnection con = new SqlConnection("connecstionstring");
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "MySp";
con.Open();
SqlTransaction trans = con.BeginTransaction();
cmd.Transac...
I have some hibernate code that performs an insert into the database, and on completion of that insert a customized PostInsertEventListener is fired. (Essentially a trigger to ensure that other records are updated appropriately)
What I need to do is make the code inside the EventListener use the same transaction as the original insert, ...
I was hoping someone could confirm my understanding of transaction behaviour in a Spring service.
Firstly, am I correct in believing that When using TransactionManager, all services which result in persistence to the database must be invoked from within a @Transactional method in order for the update to persist to the db?
Eg, Given the...
Hello everyone,
In theory, this code should set the new lock status to the users and get that written to the database:
transaction = sess.beginTransaction();
String hql = "update User set locked=:newLockStatus where principalId in (:userIds)";
Query query = sess.createQuery(hql);
query.setBoolean("newLockStatus", locked);
query.setPara...
For quite some time , I was reading about the optimistic concurrency in NHibernate. If what i understood was correct then the below sample should hold good.
Consider two transactions T1 and T2.
When T1 and T2 are done simultaneously , the state(DB entries) gets updated with the values of the most latest update.(T1 or T2).
Though it ...
Out of habit I've been using try/catch blocks in my application code for all SQL queries, with a rollback at the beginning of the catch block. I've also been committing those which are successful. Is this necessary for SELECTs? Does it free up something on the database side? The select statements aren't altering any data so it seems ...
Hi Stackoverflow,
I am writing a component and I have a scenerio of storing data into multiple tables with One-To-Many relationship.
Master table is Student and Child table is Student_Subjects.
One student can select multiple subjects.
I want to store the data in Student_subject table with student. Data is submitted from one form whe...
I am trying to use the declarative transaction management feature provide by Spring. I have set the spring configs and beans as described in reference documentation (i.e including AOP, tx namespaces and using the <tx:annotation-driven /> tag) and am using the @Transactional annotation on the method I want to be made transactional.
This ...
Hello
I'm trying to use Django's ORM in my non-HTTP part of project.
In one function I need to make bulk inserts of data, so commit_on_success decorator is what I need.
But I've found that this decorator doesn't do what supposed (didn't rollback transaction on error).
I've go into this decorator with debugger, I've fount thar reason...
Hello,
I'm learning about VB.Net and need to work with an SQLite database using the open-source System.Data.SQLite ADO.Net solution
The examples I found in the HOWTO section are only in C#. Would someone have a simple example in VB.Net that I could study to understand how to use transactions when INSERTing multiple parameters?
FWIW, h...
I have two PL/SQL Stored procedure each handling its own Transaction (Begin/Commit and Rollback in case of error). From .Net code I Call these two SP as shown below.
using (TransactionScope ts = new TransactionScope())
{
CallSP1();
CallSP2().
ts.SetComplete();
}
If my Call to SP2 fails will i...
We are expanding our hosting capabilities and want to provide MySQL database access in a large shared environment (think cloud services) - our goal is to charge per transaction per user similar to Amazon's EC2 services. What mechanisms are available for this type of DB accounting in MySQL?
...