sunil19 has asked for the wisdom of the Perl Monks concerning the following question:

Hello Guys, I need help in replicating the database dead lock in the sql server 2008 and handle the same dead lock with Exception::Class:TryCatch.pm i have searched the perlmonks,cpan sites but not able to find the releated answer. Need your valuable help. Thanks

Replies are listed 'Best First'.
Re: Dead Lock replication in Sql server
by Corion (Patriarch) on Jun 30, 2017 at 11:02 UTC

    I have some questions since your question is vague and we cannot give you a good answer without understanding the question.

    Do you have code that reproduces the database deadlock?

    Do you get a database deadlock while replicating the database to another server?

    Is your problem that you need to replicate a specific database deadlock situation?

    Do you have problems using Exception::Class::TryCatch?

    If you have problems using Exception::Class::TryCatch, please show us the code you have already written and tell us how it fails for you.

      Hello Corion, I need a simple code for replicating deadlock in sql server.After replicating the deadlock issue i need code to fix the deadlock issue by using the Exception::Class::TryCatch. Thanks

        If you need code to replicate a deadlock in Microsoft SQL Server, I think you are wrong here. Creating a deadlock in a database is not a Perl problem, it is more an SQL problem.

        Once you have the SQL to create the deadlock, use DBI to send the SQL to the server.

        Then fix the issue by using Exception::Class::TryCatch.

Re: Dead Lock replication in Sql server
by locked_user sundialsvc4 (Abbot) on Jun 30, 2017 at 14:51 UTC

    Does this series of transactions, in fact, deadlock?   If it does, then you have two choices for how to handle it.   DBI provides a RaiseError option, normally not set, which will throw an exception whenever any error occurs.   If you are particularly interested in error #1205, then you can test for that result-code and throw an exception yourself.