views:

298

answers:

3

I set up a database mirroring and then used this connectionstring to connect to it:

    Data Source={0};Failover Partner={1};Initial Catalog=AdventureWorks;
    Integrated Security=True;

After adding some data into database, I shutdown the principal server, so the mirror server becomes the principal server. I open the connection again, an get this error:

    System.Data.SqlClient.SqlException: A transport-level error has 
occurred when sending the request to the server. (provider: Shared Memory 
Provider, error: 0 - No process is on the other end of the pipe.)

I thought that with Failover Partner specified in the connection string, ADO.NET would do the work for me. So what should I do now?

This question is urgent. Thank you so much for your help.

+1  A: 

I'm not an expert about .net stuff but you need the SQL native client (SQLNCLI) to handle failover. "ado.net" may be SQLOLEDB

Up to Windows Server 2003 at least it's not installed by default. It's either standalone or part of SQL client tools, so I suspect you're using SQLOLEDB

gbn
Can you please give me more details? :).
Vimvq1987
Try Provider=SQLNCLI; conn string. I can't get onto msdn just now to find reference
gbn
A: 

After you shut down the principal, did you verify that the failover actually became the principal? If it didn't have automatic failover on the Sql Server, then you the mirror is still a mirror.

taylonr
SQL Server showed that the mirror has become the principal. I tried an T-SQL, it ran well :-s
Vimvq1987
Ok, just from playing with failover about a year ago, I know how easy it can be to miss those little things... Don't have an answer for you, sorry.
taylonr
+1  A: 

Fortunately, I fixed this problem. All I need to do is calling ClearPool method:

SqlConnection.ClearPool(conn);

This method will clear the connection pool. Then, the problem's gone. I'm so happy with it.

Thank you, all of you, for your support. :D

Vimvq1987
Yep - connection pool can cause this type of thing with both clusters and mirrors
onupdatecascade