Solved

SQL Server 2005 database mirroring problem

Posted on 2008-10-27
5
328 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
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 antispam), the admini…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

710 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