Help - why does SqlException not list Procedure name on timeout?
When I have a timeout on invoking a stored procedure against SQL
Server, I have an exception returned that looks like the following:
{System.Data.SqlClient.SqlException}
System.SystemException: {"Timeout expired. The timeout period
elapsed prior to completion of the operation or the server is not
responding."}
_errors: {System.Data.SqlClient.SqlErrorCollection}
Class: 10
Errors: {System.Data.SqlClient.SqlErrorCollection}
LineNumber: 0
Message: "Timeout expired. The timeout period elapsed prior to
completion of the operation or the server is not responding."
Number: -2
Procedure: "ConnectionRead (WrapperRead())."
Server: ""
Source: ".Net SqlClient Data Provider"
State: 0
There no additional information in the Errors collection. The
description of SqlException.Procedure property is as follows:
Gets the name of the stored procedure or remote procedure call (RPC)
that generated the error.
Is there something I'm missing? I'm trying to put together some
generic logging capabilities, and I had expected that the SqlException
would always provide the name of the stored procedure in the Procedure
property.
Thanks in advance.
Date:Fri, 27 Jul 2007 08:31:07 -0700
Author:
|
Re: Help - why does SqlException not list Procedure name on timeout?
This relies on the message that comes back from SQL Server, which AFAIK does
not include the procedure name in the case of a timeout. If you have a
try{}catch(Exception e){} around a specific call, can't you append the name
of the procedure you tried to e.Message? No, it is neither ideal nor
elegant, but in an ideal world, you would fix the stored procedure so that
it doesn't time out in the first place. :-)
--
Aaron Bertrand
SQL Server MVP
"n.phelge" wrote in message
news:1185550267.354257.320970@z24g2000prh.googlegroups.com...
> When I have a timeout on invoking a stored procedure against SQL
> Server, I have an exception returned that looks like the following:
>
> {System.Data.SqlClient.SqlException}
> System.SystemException: {"Timeout expired. The timeout period
> elapsed prior to completion of the operation or the server is not
> responding."}
> _errors: {System.Data.SqlClient.SqlErrorCollection}
> Class: 10
> Errors: {System.Data.SqlClient.SqlErrorCollection}
> LineNumber: 0
> Message: "Timeout expired. The timeout period elapsed prior to
> completion of the operation or the server is not responding."
> Number: -2
> Procedure: "ConnectionRead (WrapperRead())."
> Server: ""
> Source: ".Net SqlClient Data Provider"
> State: 0
>
> There no additional information in the Errors collection. The
> description of SqlException.Procedure property is as follows:
>
> Gets the name of the stored procedure or remote procedure call (RPC)
> that generated the error.
>
> Is there something I'm missing? I'm trying to put together some
> generic logging capabilities, and I had expected that the SqlException
> would always provide the name of the stored procedure in the Procedure
> property.
>
> Thanks in advance.
>
Date:Fri, 27 Jul 2007 11:40:08 -0400
Author:
|