Solved

SQL Server 2005 database mirroring problem

Posted on 2008-10-27
5
273 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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…
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.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now