SQLException timeout

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using the .NET SQLData Provider for accessing data from an SQL Server 2000 SP3 Server
I have an SQLDataAdapter that it is being provided an appropriate constructed SQLCommand object. The Command's object Timeout Property has been set to 0 i.e. "do not timeout". However, when I am using the SQLDataAdpter Fill method with a DataSet as parameter A and a TableName (string) as parameter B in some cases I get an SQLException with the error code -2 (i.e. timeout). This is not a reproducible behaviour. It usually happens in our customers sites.
Just to help you, it cannot be a problem of locks and SQL Server's overload because we run the process that fills in the dataset when nobody else is connected to the SQL server thus it cannot be neither a concurrency problem (locks) nor sql server's overload because there only one user in the server logged in

Could you please help me on this. In order to overcome the problem I put a loop of 30 retries to fill the dataset prior to letting the exception be thrown to the caller stack and even with this patch I still have cases that the fill fails to execute with a time-out error

What can I do to solve the problem? Is there another property that I can set in the SQL ADO.NET Objects (I had also set the connection timeout to 0)

HINTS
1. When the SQLException with the -2 error is thrown the Fill command did not wait a little bit (not even 60 secs). It looks like the error has been immediately sent from the server.
2. The query that I am using in the SQLCommand object is a liitle bit complex (it has aggregate functions, scalar columns and complex WHERE condition that uses xxx IN (SELECT YYY ...). Might be the case that the time out comes from the SQL Preprocessor
3. I put an index in a sensitive column and the exception vanished !!
4. However, this cannot be the solution. I want my queries to execute and my code wait until the execution completes without having to worry about query optimization which is something that will come in next phase of tunning

Thank you in advance

Stavros K Menegos
 
Hi Stavros,

This has been a problem with the SqlCommand object since it was released. It
should be fixed in the next release.

You can fix this by just setting the timeout to a large number of seconds
instead. Unfortunately, otherwise, 0 means zero not unlimited.

HTH,

--
Greg Low (MVP)
MSDE Manager SQL Tools
www.whitebearconsulting.com

Stavros Menegos said:
I am using the .NET SQLData Provider for accessing data from an SQL Server 2000 SP3 Server.
I have an SQLDataAdapter that it is being provided an appropriate
constructed SQLCommand object. The Command's object Timeout Property has
been set to 0 i.e. "do not timeout". However, when I am using the
SQLDataAdpter Fill method with a DataSet as parameter A and a TableName
(string) as parameter B in some cases I get an SQLException with the error
code -2 (i.e. timeout). This is not a reproducible behaviour. It usually
happens in our customers sites.
Just to help you, it cannot be a problem of locks and SQL Server's
overload because we run the process that fills in the dataset when nobody
else is connected to the SQL server thus it cannot be neither a concurrency
problem (locks) nor sql server's overload because there only one user in the
server logged in.
Could you please help me on this. In order to overcome the problem I put a
loop of 30 retries to fill the dataset prior to letting the exception be
thrown to the caller stack and even with this patch I still have cases that
the fill fails to execute with a time-out error.
What can I do to solve the problem? Is there another property that I can
set in the SQL ADO.NET Objects (I had also set the connection timeout to 0).
HINTS:
1. When the SQLException with the -2 error is thrown the Fill command did
not wait a little bit (not even 60 secs). It looks like the error has been
immediately sent from the server.
2. The query that I am using in the SQLCommand object is a liitle bit
complex (it has aggregate functions, scalar columns and complex WHERE
condition that uses xxx IN (SELECT YYY ...). Might be the case that the time
out comes from the SQL Preprocessor ?
3. I put an index in a sensitive column and the exception vanished !!!
4. However, this cannot be the solution. I want my queries to execute and
my code wait until the execution completes without having to worry about
query optimization which is something that will come in next phase of
tunning.
 
Back
Top