dbTalk Databases Forums  

how to catch deadlock victim

microsoft.public.sqlserver.clients microsoft.public.sqlserver.clients


Discuss how to catch deadlock victim in the microsoft.public.sqlserver.clients forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Massimo
 
Posts: n/a

Default how to catch deadlock victim - 03-11-2009 , 02:57 AM






Hi to All,
i'm working on SQL 2005 and C# and in my app ( multithread and
multiprocess ) sometime i have the following error:

System.Data.SqlClient.SqlException: Transaction (Process ID ??) was
deadlocked on lock resources with another process and has been chosen
as the deadlock victim. Rerun the transaction.

Since we are not the DB owners we cannot try to fix the problem on SQL
side so, we would like to be able to catch this kind of exception and
do a retry.

My question is: how can i catch this kind of exception without
searching into the message the string 'deadlock victim'? Does it have
some error number?

Thank you in advance,
Ciao!

Massimo

Reply With Quote
  #2  
Old   
Ekrem Önsoy
 
Posts: n/a

Default Re: how to catch deadlock victim - 03-11-2009 , 08:51 AM






See this link from BOL:
http://msdn.microsoft.com/en-us/library/ms179296.aspx

--
Ekrem Önsoy



"Massimo" <massimo.frade (AT) tiscali (DOT) it> wrote

Quote:
Hi to All,
i'm working on SQL 2005 and C# and in my app ( multithread and
multiprocess ) sometime i have the following error:

System.Data.SqlClient.SqlException: Transaction (Process ID ??) was
deadlocked on lock resources with another process and has been chosen
as the deadlock victim. Rerun the transaction.

Since we are not the DB owners we cannot try to fix the problem on SQL
side so, we would like to be able to catch this kind of exception and
do a retry.

My question is: how can i catch this kind of exception without
searching into the message the string 'deadlock victim'? Does it have
some error number?

Thank you in advance,
Ciao!

Massimo


Reply With Quote
  #3  
Old   
Massimo
 
Posts: n/a

Default Re: how to catch deadlock victim - 03-12-2009 , 03:10 AM



On 11 Mar, 15:51, Ekrem Önsoy <ek... (AT) compecta (DOT) com> wrote:
Quote:
See this link from BOL:http://msdn.microsoft.com/en-us/library/ms179296.aspx

--
Ekrem Önsoy

"Massimo" <massimo.fr... (AT) tiscali (DOT) it> wrote in message

news:a181a798-c923-4ec8-a965-771c59e8b994 (AT) a39g2000yqc (DOT) googlegroups.com...

Hi to All,
i'm working on SQL 2005 and C# and in my app ( multithread and
multiprocess ) sometime i have the following error:

System.Data.SqlClient.SqlException: Transaction (Process ID ??) was
deadlocked on lock resources with another process and has been chosen
as thedeadlockvictim. Rerun the transaction.

Since we are not the DB owners we cannot try to fix the problem on SQL
side so, we would like to be able tocatchthis kind of exception and
do a retry.

My question is: how can icatchthis kind of exception without
searching into the message the string 'deadlockvictim'? Does it have
some error number?

Thank you in advance,
Ciao!

Massimo
Thank You for your answer but the problem is that we are not working
with SP but with NHibernate. moreover, we are not the DB owners.
What i'd like to know is the specific Exception number, in order to
identify this kind of exception.
Do you know that number or a guide where to retrieve it?
Thanks,
Massimo


Reply With Quote
  #4  
Old   
Ekrem Önsoy
 
Posts: n/a

Default Re: how to catch deadlock victim - 03-12-2009 , 09:52 AM



I'm afraid you didn't even open that page? Error number for the victim is
1205 as it's stated on that link too.

--
Ekrem Önsoy



"Massimo" <massimo.frade (AT) tiscali (DOT) it> wrote

On 11 Mar, 15:51, Ekrem Önsoy <ek... (AT) compecta (DOT) com> wrote:
Quote:
See this link from
BOL:http://msdn.microsoft.com/en-us/library/ms179296.aspx

--
Ekrem Önsoy

"Massimo" <massimo.fr... (AT) tiscali (DOT) it> wrote in message

news:a181a798-c923-4ec8-a965-771c59e8b994 (AT) a39g2000yqc (DOT) googlegroups.com...

Hi to All,
i'm working on SQL 2005 and C# and in my app ( multithread and
multiprocess ) sometime i have the following error:

System.Data.SqlClient.SqlException: Transaction (Process ID ??) was
deadlocked on lock resources with another process and has been chosen
as thedeadlockvictim. Rerun the transaction.

Since we are not the DB owners we cannot try to fix the problem on SQL
side so, we would like to be able tocatchthis kind of exception and
do a retry.

My question is: how can icatchthis kind of exception without
searching into the message the string 'deadlockvictim'? Does it have
some error number?

Thank you in advance,
Ciao!

Massimo
Thank You for your answer but the problem is that we are not working
with SP but with NHibernate. moreover, we are not the DB owners.
What i'd like to know is the specific Exception number, in order to
identify this kind of exception.
Do you know that number or a guide where to retrieve it?
Thanks,
Massimo



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.