transactions

SQL Server transactions - whole db locked ?

Hi, I have a problem on specific SQL Server 2008 customer installation. I wrote the code below to simulate the problem which happens in more complex system. There are two connections (each one with own transaction) opened and each connection modifies a table. Modified tables do not relate to each other. On development platform and other ...

Is there a way to determine that a Connection is managed?

I have some legacy JDBC code that is used within an EJB, in this code a call to setAutocommit() is made (which is not allowed for managed transactions, for understandable reasons). I would like to skip this method call if the code is used within a managed transaction, but let the call remain if used in an un-managed context. Is there a...

SQL Server: how transactions work

In SQL Server, how many transactions will this produce? DECLARE @deleted BIGINT SET @deleted = 100000 WHILE @deleted = 100000 BEGIN DELETE TOP(100000) FROM MYTABLE WITH (ROWLOCK) where Col1 = 7048 and COL2 = 39727 and Col3 = 0 SET @deleted = (SELECT @@ROWCOUNT) END If I cancel after running this for 10 minutes will it need to roll bac...

How to perform updates in entity framework 3.5 within an SqlTransaction

I'm working on a plugin that gets loaded via IOC from a 3rd party data driver. The plugin and data driver both operate on the same SQL Server 2005 database, but the plugin focuses on a small subset of tables that have foreign key relationships to the tables that the data driver manages. My problem is that in some operations, the data d...

Multiple prepared statements disrupt a transaction using DBD::Sybase

In my Perl script, I use DBD::Sybase (via DBI module) to connect to a SQL Server 2008. The base program as below runs without problem: use DBI; # assign values to $host, $usr, $pwd my $dbh = DBI->connect("dbi:Sybase:$host", $usr, $pwd); $dbh->do("BEGIN TRAN tr1"); my $update = $dbh->prepare("UPDATE mytable SET qty = ? where name = ?");...

design patterns for transactional services with checkpoints and recovery

I have a multistep process where each step does some network IO (web service call) and then persists some data. I want to design it in a fault tolerant way so that if the service fails, either because of a system crash or one of the steps fails, I am able to recover and re-start from the last error free step. Here is how I am thinking o...

Establishing entity groups while maintaining access to Long ids

I'm using the appengine datastore, and all of my entities have Long ids as their PrimaryKey. I use those ids to communicate with the client, since the full-fledged Keys take much more bandwidth to transmit. Now, I want to form entity groups so that I can do complex operations within transactions, and it seems from http://code.google.co...

MySQL Cluster transaction isolation level - READ_COMMITTED

Hello, I'm a beginner. I'm learning by mostly reading the documentation. Unfortunately, http://dev.mysql.com/doc/refman/5.1/en/set-transaction.html#isolevel_read-committed doesn't say anything, while it says everything. Confused? Me too. ndb engine supports only "READ_COMMITTED" transaction isolation level. A. It starts by saying "set...

Nhibernate Update does not persist change to database

I have a problem getting my change(s) to data object retrieved using NHibernate to persist back into the database. I get no exceptions so it's difficult to know where to look. Any suggestions? string name = "somenewname"; string repositoryId = "somerepositoryid"; ISession nhbSession = GetNhbSession(session); nhbSession.Transaction.Begi...

Is NOLOCK the default for SELECT statements in SQL Server 2005?

I have only SQL Server 2008R2 installed though I need to communicate with customers having 2005. [1] tells: "NOLOCK This does not lock any object. This is the default for SELECT operations. It does not apply to INSERT, UPDATE, and DELETE statements" [2] doesn't seem to mention it, but my checking in SSMS/SS 2008R2 shows that n...

What transaction manager to use? (JPA, Spring)

Hi! I'm developing a web application based on JPA + Hibernate, Spring and Wicket. I was wondering what's the best way of implementing transactions in my code? What transaction manager should I use? Should it be org.springframework.orm.jpa.JpaTransactionManager, or org.springframework.jdbc.datasource.DataSourceTransactionManager or someth...

Spring Transaction - automatic rollback of previous db updates when one db update failes

I am writing a simple application (Spring + Hibernate + PostgreSql db). I am just trying to construct a sample object and persist in db. I run a simple java class main method where i have loaded the applicationContext and have got reference to the service class as below TestService srv = (TestService)factory.getBean("testService"); ...

example of spring declarative roolback-for?

want declarative transactional management example in spring aop........ Actually Here <aop:config> <aop:advisor advice-ref="addAdvice" pointcut="execution(* com.DAO.*.*(..))"/> </aop:config> <tx:advice id="addAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="add*" propag...

How to set-up transactions for both web application and batch jobs using Spring and Hibernate

I have an application which uses Spring 2.5 and Hibernate 3. There's a web application with a presentation layer, a servive layer and a DAO layer, as well as some Quartz jobs sharing the same service and DAO layers. Transactions are initialized in different layers with @Transactional annotations, like this: It led me to a problem ...

ADO.Net Transaction Not Working

I have the following code (I'm new to .NET transactions) and it does seem to be executing at all. It's called through a webservice and is difficult for me to debug: public void UpdateJailFiles(List<RMS.NameFile> names, RMS.Incident incident, int currentDate, int currentTime, int incidentKey) { String library = RMSLIBRARY; ...

EJB-like transactions in JAX-RS

I'm adding a RESTful API to an existing application (JBoss 4, EJB 2, adding RESTEasy). The application currently has Session beans with container-managed transactions. To start with, I'm calling remote interfaces on the Enterprise Beans. The EJB usage is being phased out, so new functionality will be added without writing new methods ...

TransactionScope causing blocking?

I'm writing some Unit tests against a database, and we're using transactions to make sure that our test data gets removed at the end. I'm running into a problem where methods that I'm testing are using their own TransactionScope objects, and it seems to be blocking when hitting the database. This is inside my test's base class: BaseSc...

Understanding locking behavior in SQL Server

I tried to reproduce the situation of question [1]. On table, taken and filled with data from wiki's "Isolation (database systems)" [2], in SQL Server 2008 R2 SSMS, I executed: 1) first in first tab (window) of SSMS -- transaction isolation level in first window does not influence results (?) -- initially I thought that second ...

Sqlite Transaction, syntax error. Insert and delete in same transaction

I have a list of items that I want to insert into the database but I do not want any duplicates. So I delete all the items and reinsert all. It's not the most efficient way but it's not many items so it works for me. But I get syntax error near "Insert". I do the following: DELETE FROM Settings WHERE Type = 'Extensions' INSERT INTO Sett...

Howto use Rollback/Commit in Oracle SQL

I am trying to utilize transaction functionality in Oracle SQL for the first time and can't seem to find a good explanation. I understand that starting a new session will begin a new transaction. I also understand that commit/rollback is used to end it. What I am trying to do is execute two statements and if I either of them fail, und...