Solved

SQL Server 2005 database mirroring problem

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

770 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