Home All Groups Group Topic Archive Search About

SQLException and mulitple threads

Author
22 Nov 2007 4:46 PM
Henk Kelder
We run a service using multiple thread, all of them doing database access.

Whenever the database stops or another another error occurs a SqlException
is thrown.
We log these exception using the exception building blocks and our logs show
that
multiple threads report the same exception, and I mean really the same..
even the same stacktrace.

So I get in thread 1 an exception showing a stacktrace that belongs to
another thread.

My theory is that before the exception is logged, in another thread another
exception occurs,
and the SqlClient overwrites the data in the first exception.

MSDN states that SqlException is not threadsafe.

Can anyone shed some light on this?

Henk Kelder
Capgemini Nederland

AddThis Social Bookmark Button