views:

26

answers:

1

hi,

i am doing a unit test against my project. in one case, i have to stop the sql server and verify if my application could handle such exception elegantly.

but i found the after this test case has run, any test case run after it would fail if the test case need to access the database. and the error was 'transportation level error'.

in each test case, i will setup a new sql connection and close it gracefully. i think the test cases are isolated very well. i do not understand why restarting the sql server would cause such error.

currently, i will have to hit the sql server myself after it is restarted. i think it is really an ugly fix.

A: 

This is normal. Restarting the SQL Server means that all connections get killed, including your application's (possibly pooled) connection. I think you just have to handle this error and retry. Which admittedly is a pain.

Martin Smith
yeah, i guess it has some thing related to the sql connection pool. but i think after i have restarted the sql server, the connection pool should all be invalid, and sql server should not return me the pooled connection.
davidshen84