sqldatareader not having a valid connection after db restarts?

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

Guest

I have a business object (c#) running on an app server that talks to my sql server 2000 (2 separate physical machines). If sql server gets restarted (i.e. someone kicks the cord out of the wall on the db server and it needs to be restarted), the connections that IIS is maintaining seem to be invalid. If someone can verify that or explain a little about how the internals of that works, that would be educational for me but I'll take it on faith from the results of my tests. In order to recreate valid connections I have my ExecuteReader statement in a try/catch. If I call close and then open on the connection object once, the call to ExecuteReader still fails. However if I call close/open a second time, ExecuteReader succeeds. I would really like to understand what is happening here if someone has a better understanding or can explain why this voodoo works

thanks
chris
 
cp said:
I have a business object (c#) running on an app server that talks to my
sql server 2000 (2 separate physical machines). If sql server gets restarted
(i.e. someone kicks the cord out of the wall on the db server and it needs
to be restarted), the connections that IIS is maintaining seem to be
invalid.

I don't know exactly how your app is structured, but the Sever being
restarted sounds like the most likely problem. I assume you have connection
pooling turned on?

Anyway, you are using the same connection right? This doesn't happen if you
re-instantiate a new connection object and try to open it or use some other
connection somewhere else?

Also what specific exception are you getting?

If someone can verify that or explain a little about how the internals of
that works, that would be educational for me but I'll take it on faith from
the results of my tests. In order to recreate valid connections I have my
ExecuteReader statement in a try/catch. If I call close and then open on the
connection object once, the call to ExecuteReader still fails. However if I
call close/open a second time, ExecuteReader succeeds. I would really like
to understand what is happening here if someone has a better understanding
or can explain why this voodoo works.
 
Back
Top