java - removing deadlock issue with sql server 2008 while reading and writing data -



java - removing deadlock issue with sql server 2008 while reading and writing data -

java.sql.batchupdateexception: transaction (process id 58) deadlocked on lock resources process , has been chosen deadlock victim. rerun transaction.

i have 2 java application 1 reading info sybase , writing sql server 2008 , reading info sql server 2008 table , writing other table. 2 application works fine. have many people accessing info mssql table sec application updates info every 30 sec. above exception. saw similar thread here in stackoverflow help deadlock in sql server 2008 have problem solution presented here

row versioning

can user rowversioning avoid dead locks in situation , how utilize it?

edit

string selectallquery = "select new_site_id gis.map.ro"; string selectquery = "select siteid gis.map.status alarmcode in ('1','2','3') , localnodealias 'flm%'"; string updatequery = "update gis.map.ro set active_site_status = ? new_site_id = ?"; string updateallquery = "update gis.map.ro set active_site_status = site_status new_site_id = ?";

so, select gis.map.status table , update update gis.map.ro table. gis.map.status table update every 30 sec(the whole table deleted , inserted 2 task

inserting gis.map.status goes first , transaction committed updating gis.map.ro table goes sec , transaction committed finally, info gis.map.ro accessed many user 3rd party application. actually deadlock occours @ instance.

in cases deadlocks indicate there's wrong implementation - there's problem query order, locking order or bring together order. i'd suggest collecting , analyzing deadlocks (msdn: analyzing deadlocks sql server profiler) may find exact places in code deadlocks occur , prepare them.

java sql sql-server sql-server-2008

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -