locked
SQL Server SqlConnection error RRS feed

  • Question

  • Hi,

    I'm having trouble accessing our SQL Server that resides in another domain.  I'm developing a Windows Form app that needs to access a SQL Server database residing in the other domain.

    My connection string uses an IP address: 

    "Network Library=DBMSSOCN;Data Source =ipaddresshere; Initial Catalog=dbname; Connection Timeout=320;User id=username; password=pwdhere"

    But I get an error on the line of code that opens the SqlConnection: 

    "A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - An existing connection was forcibly closed by the remote host.)'

    The user has Admin rights to the production server (Windows Server 2012 R2 version) and all necessary rights to the SQL Server 2012 Standard; the server allows remote connection;  the domain that the target server resides in is a 'private network' domain--i.e., it's not part of our regular LAN (where my dev machine resides) but my dev machine has  a direct line to it.

    Hoping someone can shed light on what's going on.  I'm not sure if I'm in the right Forum category.  Sorry if I am, but I don't know where this issue belongs.


    Marilyn Gambone

    Monday, November 4, 2019 3:20 PM

Answers

  • Can you check below

    1. Ping <sqlserver>

    2. Then ping the ip from step 1... ping -a <ip>

    It should resolve the hostname

    Check SQL browser service is enabled and running?

    Is firewall enabled (default port 1433, unless you changed it) on ?


    Best Regards. Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.

    • Marked as answer by deskcheck1 Monday, November 4, 2019 8:13 PM
    Monday, November 4, 2019 3:43 PM
  • The SQL Server error log will indicate exactly why it was refused.

    • Marked as answer by deskcheck1 Monday, November 4, 2019 8:13 PM
    Monday, November 4, 2019 7:29 PM

All replies

  • Can you check below

    1. Ping <sqlserver>

    2. Then ping the ip from step 1... ping -a <ip>

    It should resolve the hostname

    Check SQL browser service is enabled and running?

    Is firewall enabled (default port 1433, unless you changed it) on ?


    Best Regards. Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.

    • Marked as answer by deskcheck1 Monday, November 4, 2019 8:13 PM
    Monday, November 4, 2019 3:43 PM
  • The SQL Server error log will indicate exactly why it was refused.

    • Marked as answer by deskcheck1 Monday, November 4, 2019 8:13 PM
    Monday, November 4, 2019 7:29 PM
  • Hi All,

    Thanks for the reply.  I think I found the answer.  The SQL Server was installed "incorrectly", I'm guessing.  It was installed as default SQL Server in the server.  At the same time, when I execute "SELECT @@SERVERNAME" to verify the instance name, it gives me a different SQL Server instance name from what is shown in the properties.  So, there seems to be a conflict in the SQL server name and instance name.  It also has errors in its database location (referencing a Drive but when I check it, the database is not in there).

    When I pinged the default SQL Server name, it timed out.  When I pinged the SQL server instance name it said "could not find host".

    When I pinged the IP address, it's correct.

    So...I'm guessing some mistakes where made installing it.  I'll just re-install it now.


    Marilyn Gambone

    Monday, November 4, 2019 8:22 PM