We have a program that connects to our DB and run some Stored Procedures to get some data.
The database is a SQL Server 2008 and the program runs locally. The connection is via TCP/IP, but shared memory is enabled. And the timeout of the connection string is set to 45 sec.
When we run them through SQL Server Management Studio, it takes 0-5 seconds to run. When we run it through code, it randomly times out.
To make some test, we increased the timeout from 45sec to few minutes. And also to discard any blocking issue we checked that the Stored Procedures only "selects" data (with no insert or update statement). And we have tried several table modifiers for the select statements like: nolock
, readpast
, ...
Also I checked sp_who2
and dbcc opentran()
and nothing is blocked... and the SPID of the .Net is running command ...
. For more details while the .Net is waiting a DB answer, through SQL Server Management Studio I can run the same statement (Stored Procedure or Select) without problems.
Any suggestion of what is happening?