Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SQL Server 2005 database mirroring problem

Posted on 2008-10-27
5
Medium Priority
?
341 Views
Last Modified: 2008-11-27
Hi,
We are using database mirroring to our SQL Server 2005 database. And I put the failover partner to the connection string. We found the following problem:
If the database server switched to the mirror one when the use is entering data to the database, we will get the following error:
"A transport-level error has occurred when sending the requests to the server (provider: TCP Provider, error: 0-An existing connection was forcibly closed by the remote host)

As I undertand the ADO.NET should detect that the connection to the old principle has failed, and automatically rety connecting to the new principle one. But why I still get this error?

Thanks a lot.
0
Comment
Question by:Jinghui Li
  • 2
5 Comments
 
LVL 26

Expert Comment

by:Anurag Thakur
ID: 22820507
it depends how are you accessing your database from the application and how are your mirror servers aliased so that when one server is made in-active and the other active then the DNS name given will be pointing to the new server which has been made active
0
 

Author Comment

by:Jinghui Li
ID: 22822269
Thanks for your comments. I am very clear for your explaination. Actually what does this error mean?

Here is my code to access the database from my C# application:
SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
 conn.Open();
cmd.ExecuteNonQuery();
conn.Close();

the exception is thrown on the cmd.ExecuteNonQuery();

Many thanks,




0
 
LVL 26

Accepted Solution

by:
Anurag Thakur earned 2000 total points
ID: 22822713
in case of a mirror you have 2 machines
Machine1 & Machine2 and you will have an alias on the DNS like DBMachine which first points Machine1 but as soon as you switch now the DNS entry for DBMachine should point to Machine2 and till the time this whole process is not over the database will not be available and you will get transport error as you connection has been established but the results cannot be retrieved
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question