java.sql.BatchUpdateException: Transaction (Process ID 58) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
I have two java application one reading data from sybase and writing to an sql server 2008 and another reading data from sql server 2008 table and writing it to other table. Now the two application works fine. But I have many people accessing data from mssql table where the second application updates data every 30 sec. So I get the above exception. I saw similar thread here in stackoverflow but Deadlock troubleshooting in Sql Server 2008 I have problem with the solution presented here with
浏览版本
我能够利用浏览来避免我局势中的致命锁,我如何利用它?
<><>Edit>/strong>
String selectAllQuery = "Select new_site_id from GIS.MAP.ro";
String selectQuery = "Select siteId from GIS.MAP.status where AlarmCode in ( 1 , 2 , 3 ) and localNodeAlias like FLM% ";
String updateQuery = "update GIS.MAP.ro set active_site_status = ? where new_site_id = ?";
String updateAllQuery = "update GIS.MAP.ro set active_site_status = site_status where new_site_id = ?";
因此,我从GIS.MAP.status
table and UpdateGIS.MAP.ro/code> table. 实际
GIS.MAP.status
表格还更新了每30个附件(整个表格删除并插入,但两项任务除外)。
- inserting into GIS.MAP.status goes first and transaction is committed
- updating GIS.MAP.ro table goes second and transaction is committed
- Finally, The data from GIS.MAP.ro is accessed by many user by third party application. Actually the deadlock occours at this instance.