deadlock detection | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

deadlock detection

We are using JDBC with SQL Server 2000.
Does anyone know how to detect a deadlock – i.e. the victim gets rolled back and a SQLException is thrown. (similar to ODBC) I get the SQLState (5 character code) from the exception and try to classify
the exception based on that, but I can’t find any state corresponding to a deadlock. Thanks,
Barry
According to BOL the native error raised by sql server is 1205 for a process that has become the selected victim of a deadlock situation. I’m not too familar with JDBC but in ADO the error can be exctracted by accessing the native error of the errors collection. Since it’s sql server raising the error I would assume you should get a similar error number, have you tried viewing all properties of the SqlException to find if one of the error properties are raising this error? Cheers
Shaun World Domination Through Superior Software
Thanks. It is possible to get the Vendor error code from a SQLException – I was hoping to avoid
doing this, since the number of error codes is large, while the states are more managable. I will try to force a deadlock in a simple program and see what gets thrown. Barry
quote:Originally posted by trifunk According to BOL the native error raised by sql server is 1205 for a process that has become the selected victim of a deadlock situation. I’m not too familar with JDBC but in ADO the error can be exctracted by accessing the native error of the errors collection. Since it’s sql server raising the error I would assume you should get a similar error number, have you tried viewing all properties of the SqlException to find if one of the error properties are raising this error? Cheers
Shaun World Domination Through Superior Software

]]>