Microsoft
Software
Hardware
Network
Question : In database mirroring. connection problem to failover partner when original principal is disconnectet
Hey guys,
I have a problem with database mirroring. I'm using windows server 2008 r2 enterprise with sql server 2008 enterprise installed. I user mirroring in high availability mode with a witness server running on sql server 2008 express.
i use the following connectionstring to connect to the database
connectionString="Data Source=mainsql;Failover partner=failover;Initial Catalog=DefaultDataBase;Us
er ID=******;Password=******"
providerName="System.Data.
SqlClient"
this works fine in the following situations.
1. when performing a manual failover.setting the failover as prinicpal. and vice versa.
2. if failover is set as principal and i shut the failover down so that mirror sets mainsql as principal.
my problem is that when i take the principal down so that the witness sets the failover as principal. while the principal is disconnected the clients will sometimes get an error when trying to connect to the server.
the following event is logged at the client server:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Testing has shown on our production server that 1 in 400 attempts to connect to server throws this error.
I've managed to reproduce this error in our test enviroment. i then use the following connection string.
connectionString="Data Source=som bogus IP;Failover partner=Ip to the principal server;Initial Catalog=DefaultDataBase;Us
er ID=******;Password=******"
providerName="System.Data.
SqlClient"
This testing suggests that when no connection has been made to database in 3-4 minutes this error occurs for about 2-3 seconds. then i have acces again as long as i don't wait for another 3-4 minutes to query the database. We use connection pooling, i've tried to reset the connection pool before each request as i thought that maybe this would make it fail every time. however the 3-4 minutes still remains.
the clients that needs to connect to this system is both a sql server 2005 and asp.net webapplication. Both these clients experiences the same problem.
Answer : In database mirroring. connection problem to failover partner when original principal is disconnectet
Figured it out. if i used failover partner instead of partner in the connection string, everything works.
Random Solutions
Remove underscore from begining of filenames?
"The project location is not trusted." error when in XP Mode
How to Submit HTML Form in VB.Net
Acces table calculated field and query filter
Access - Feed a constant value into sub-forms
sql server search query
SQL Query - Simple Syntax Issue
Outlook popping and recent contacts not working
The description for Event ID ( 0 ) in Source ( .... ) cannot be found
How can I trigger the event On click of a page in a tab control?