transactions

TSQL try catch transaction error handling, transaction count mismatch

纵饮孤独 提交于 2019-12-24 09:39:19
问题 I have a sproc that I am calling from C# with a transaction by doing: using (var dbContext = PowerToolsDatabase.GetDataContext()) { dbContext.Connection.Open(); using (dbContext.Transaction = dbContext.Connection.BeginTransaction(System.Data.IsolationLevel.Serializable)) { foreach (var element in package.AddOrUpdateElements) { dbContext.usp_Element_Commit( /* args */); } dbContext.Transaction.Commit(); } } And in that sproc there is a try catch, and a RAISERROR inside the try part that is

PDO bug: prepare() with multi-queries doesn't work inside a transaction

瘦欲@ 提交于 2019-12-24 08:36:22
问题 Searching for the solution to my previous question I've come across a weird fact - PDO prepare() with multi-queries does not work correctly inside a transaction. You get no warning, no exception, nothing - just silence and no commit/rollback. Furthermore, you get no exception even if some of the queries except for the first one contain errors. Although if the first query contains an error you get an exception as expected. If there is no transaction everything works fine. If you put several

Test DAO in java using Junit4 and Hibernate

不想你离开。 提交于 2019-12-24 08:35:10
问题 Testing DAO'm using junit and mainly what I do is start a transaction in hibernate, call the compare function, and then roll back the transaccion.El problem is that if I'm Testing function is a transaction error I can not strip nest, I thought about the idea of ​​implementing DBUnit xml but management does not seem a good idea and less in this instance that I did enough test cases with this method. Anyone have any idea how to fix it without having to use anything other than Junit or hibernate

Spring transaction management breaks hibernate cascade

不羁岁月 提交于 2019-12-24 08:14:35
问题 I'm having a problem where the addition of spring's transaction management to an application causes Hibernate to throw the following error: org.hibernate.HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance: org.fstrf.masterpk.domain.ReportCriteriaBean.treatmentArms org.hibernate.engine.Collections.processDereferencedCollection(Collections.java:96) org.hibernate.engine.Collections.processUnreachableCollection(Collections.java

Can a SSIS package called using xp_cmdshell enlist in a SQL Server transaction?

早过忘川 提交于 2019-12-24 08:07:57
问题 I have a very basic SSIS package with one data flow task (from an OLE DB Source to a Flat File). The TransactionOption property is set to Required and I have tried the IsolationLevel option set to ReadCommitted, ReadUncommitted and Serializable. The package exports all rows from a table [TestTable] to the flat file. I have the following SQL script (that I'm running in Management Studio for the moment): BEGIN TRANSACTION DELETE FROM [dbo].[TestTable] DECLARE @SsisString VARCHAR(8000) DECLARE

Transactions in Azure Functions with multiple outputs

半城伤御伤魂 提交于 2019-12-24 06:30:56
问题 How are we supposed to handle transactions when having multiple output bindings in an Azure function and i have to guarantee that writing to all of the outputs has succeeded? Does the runtime provide some sort of distributed transaction handling or do i have to build everything myself? For example i have a binding to DocumentDb and to Blob Storage. For some reason writing to Blob Storage fails. Is there a possiblity to rollback the whole operation? 回答1: Runtime does not provide any

Are schema modifying commands transactional?

泄露秘密 提交于 2019-12-24 06:23:14
问题 For example, if I drop a table then roll back the transaction is the table recreated? What are the limits to the schema changes that can be made in a transaction? If the above depends on the version of Sql Server, please say so... Background I am thinking of using some “select into” statements to create tables and then need to drop ALL the above tables as a later part of the workflow. None of the table will have more then a few tens of rows. 回答1: Most database object DDL statements can be

How to lock row in mysql without blocking?

不想你离开。 提交于 2019-12-24 05:49:39
问题 I have a table in mariadb where I save links to some RSS feeds: id | url | done ------------------------------------ 1 | http://example.com/rss | true 2 | http://example.org/rss | false 3 | http://google.com/rss | false When now one process/worker is updating one of the RSS feeds I want it to hide the row from other processes/workers so that they don't do the work twice and deadlock. Using SELECT ... IN SHARE MODE or SELECT ... FOR UPDATE does not work as the row is still visible and will

System Resources Exceeded whilst performing UPDATE SQL in Access inside Transaction

心已入冬 提交于 2019-12-24 05:00:11
问题 I'm performing a simple UPDATE tblTable SET DataSet=3 inside a transaction, but a few seconds after trying to run it, I get a 3035 - System Resources exceeded. There are ~30K rows. Dim db As DAO.Database, wrk As DAO.Workspace, errCount As Long, stSQL As String Set db = CurrentDb Set wrk = DBEngine.Workspaces(0) errCount = 0 wrk.BeginTrans Debug.Print "There are no existing entries in the selected DataSet, preparing to proceed..." ' - -- --- stSQL = "UPDATE tblImportCleaned SET DataSetID=" &

Concurrency scenarios with INSERTs

自闭症网瘾萝莉.ら 提交于 2019-12-24 04:44:05
问题 I'm designing a booking system in PHP + PostgreSQL. I'm not able to find a clean solution to a concurrency problem based on INSERTs operations. The DB system is mainly made of these tables: CREATE TABLE booking ( booking_id INT, user_id INT, state SMALLINT, nb_coupons INT ); CREATE booking_state_history ( booking_state_history_id INT, timestamp TIMESTAMP, booking_id INT, state SMALLINT); CREATE TABLE coupon_purchase( coupon_purchase_id, user_id INT, nb INT, value MONEY) CREATE TABLE coupon