I have a stored proc to query a very large database, and it always times out at the 30th sec, even though I have changed the connect timeout to 300, as follows
(Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.)
Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Documents and Settings\Administrator\My Documents\abc.mdf";Integrated Security=True;Connect Timeout=300;User Instance=True
This timeout issue does not occur to smaller databases. Any idea?
hi,
the connection timeout setting is relevant to "connection timeout"
you have to modify the command timeout property within your code so that the executing command enables more time..
tipically
Dim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand With cmd .CommandText = "the command text or procedure name" .CommandType = CommandType.Text ' or CommandType.StoredProcedure .CommandTimeout = 300 'or whatever .Connection = yourConnectionObject End Withregards
|||Thanks for pointing out this. Can this be done once for all / globally, say by using a SQL statement?|||hi,
AFAIK, that should be done for each command..
regards
|||I wish I am not asking too much, but how can this be done in a stored procedure, please?|||hi,
actually that should be done outside the procedure, in the command (or whatever you use) to execute the actual procedure..
there's a server wide option, query wait, but I'd not set it to a defined/manual value as this one will be valid for all queries at instance level (again, server wide option).. I'd go for the standard behavior only setting "manual configurations" for particular activities via the (external) command property..
regards
No comments:
Post a Comment