I'm fixing bugs and enhancing an application that has an
intermittent Timeout error ([Microsoft][ODBC SQL Server
Driver]Timeout expired) occasionally thrown during a the
execution of SQL queries (actually the execution of stored
procedures). I have a function that I call (passing the
SQL string), and inside that function is a Try/Catch
block. So I'm handling the error by displaying an error
message and putting the user back on the submitting page.
1) Do you know of any way I can get the ODBC driver to
throw this error, on demand? I need to throw the error in
a predicatble way, so I can test various solutions. I
tried things like turning sql off, etc. but I get
back "server not found" or "unable to connect" type
errors, not timeouts.
2) What are your ideas regarding handling timeouts, and
avoiding them in the first place? The crux of this
question is that I want to handle the timeout simply by
trying again. We only get this error once or twice a week
in an environment where this app is used all day, every
day by 30 ppl. I suspect that the timeouts come because
of some random issue on the network, or maybe the SQL
server itself. And I also suspect that if I could just
immediately try again, it would work (the second time
around), and the users would only see it as a response
time issue instead of as an error.
Thanks in advance for your help and ideas.