locked
Mirror - Application trying to connect to mirror DB randomly RRS feed

  • Question

  • Hello all,

    So we have a couple of SQL Server 2008R2 instances involved on mirroring without witness and operating mode is asynchronous in all cases and we do not use witness, so there is no automatic failover.

    After we set put mirroring in place, we started facing connections issue on our applications like this one:

    org.apache.torque.TorqueException: org.apache.commons.dbcp.SQLNestedException: Could not retrieve connection info from pool Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user XXXXXX.

    After some investigation we saw in the alert log of the mirrored instance errors like this:

    Login failed for user XXXXXX. Reason: An error occurred while evaluating the password.

    Connection string used on the app side:

    torque.dsfactory.service.connection.url = jdbc:sqlserver://SERVER_IP:INSTANCE_PORT;databaseName=DB_NAME;applicationName=AP‌​P_NAME torque.dsfactory.service.connection.user = XXXXXX

    So, this makes me think that somehow the application is trying to connect to the mirrored instance instead of connect to the active one. Since all logins are disabled on the mirror side the connection is rejected.

    I saw some persons asking the same, but never saw any explanation for this issues. Does anyone had this type of issues and knows what the problem is? I do not see any problem on the mirroring configuration, but I may be wrong...


    Thursday, October 16, 2014 9:23 AM

All replies

  • Please check permission level of the application username is having with SQL Server, this might be the issue or the app user doesn't exist on the mirrored database itself.

    Tuesday, October 21, 2014 2:15 PM
  • Did you by any chance ever figure out the issue. I seem to be having the same or related issue. In may case I do not have mirroring set up at all. I have a separate database server setup on a separate machine in different subnet and my users are randomly connecting to that instance. I too am seeing the login errors in the other servers error logs. I don't have mirroring turned on at all, so I am at wits end trying to figure out how they are getting there.

     
    Thursday, August 27, 2015 10:57 PM
  • That sounds like a Reilly weird bug in the driver... The only other explanation I could possibly think of is that you are using some kind of linked server queries... In this case you would end up having an authentication to the remote server with the user depending on the config...

    Have you tried doing a network trace on the system? I would like to ensure that the connection really is sent directly from that client and not "proxied" somewhere.

    Monday, August 31, 2015 6:09 PM
  • In our case, it turned out to be a DNS issue. One of our local DNS servers were down, and as a result, when the one that was still up did not respond in time, the DNS request went out to the ISPs DNS. Additionally, we had a * NS record setup for our web server, and apparently the DNS request for our local database server had our domain appended to it when the DNS request was sent to the ISP. Thus, the DNS response from our ISP returned the IP address of our webserver, and a connection was attempted on the database server on the webserver even though we were attempting to connect to our local DB server.

    There went a few days work. Oh well.

    Thanks for the reply.

    Monday, August 31, 2015 6:23 PM