4

I have two mirrored SQL Servers (A and B for example). I wrote a simple C# program (connect via SqlConnection), which insert rows into DB. When I make failover on server A, the program throws exception, then I try reconnect, and get exception by timeout (**A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0**).

When I restart the app, the connection is successfully established (to server B). Next, I make failover on B server, and program throws exception, then I try to reconnect, and its work - connection to A witout restarting program.

My connection string:

Data Source=SERVER_A;Failover Partner=SERVER_B;Initial Catalog=TEST_DB;persist security info=True;user id=USER_LOGIN;password=USER_PASS;Connection Timeout=60;

I also try to set big timeout (60 seconds), and try to clear All sqlconnection pools, clear single pool by connection, but it is not working.

Interesting fact: if I use domain login and password, all works fine! (user SID are same)

Serhii
  • 47
  • 5
  • Failover Partner caching is described in some detail here http://blogs.msdn.com/b/spike/archive/2010/12/08/clarification-on-the-failover-partner-in-the-connectionstring-in-database-mirror-setup.aspx – ta.speot.is Jul 03 '14 at 09:26
  • Thanks for comment (a saw this page yesterday), but this is not help me... – Serhii Jul 03 '14 at 11:09

1 Answers1

0

Hard to tell what your exact problem is. Perhaps it's that failovers aren't instant, and can't transfer query state - see https://dba.stackexchange.com/questions/27528/can-availability-groups-provide-seamless-failover-with-no-query-failures. If your application immediately retries the query the failover node may therefore still be in the process of taking over and therefore not ready to accept connections.

Community
  • 1
  • 1
MonkeyPushButton
  • 1,077
  • 10
  • 19