Solved

SQL Server 2005 database mirroring problem

Posted on 2008-10-27
5
314 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 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 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