none
How to connect sql database on different network?

    Question

  • Hi everyone,

    I am a fresh graduated and started the job last month. I am working as a programmer (C#).
    Firstly, I would like to say thanks to MSDN Forum because whenever I face the problems with sql database and programming, I come to this forum and got the solution to solve my issues. Thanks a lot. Now, I got the problem concerning with sql database remote access from different network.

    My job scope is to retrieve the data from sql database via internet because we won't use the same network. I've already tried with various solutions that are posted in the forum. I tried the following methods on the server machine to be able to connect the different network database.

    1) On SQL Server Configuration Manager, sql server and sql browser services are running and TCP and Named Pipes are enabled. In the properties of TCP Port, set the default port number (1433).

    2) On Sql Server Management Studio, allow the remote connection and use the mixed authentication (Windows and sql server authentication).

    3)On Firewall setting, open the TCP port (1433) and UDP port (1434) and add sqlservr.exe and sqlbrowser.exe to the exception list.

    But I still cannot connect to the database server. I have the server's server name that is not used the instance name and public ip address. I can ping the host name and ip address of the server on command prompt. But I cannot connect to their database on my Sql Server Management Studio. There is no a network technician at the server site so, I need to configure their network to allow the remote connection for my program. So, I would like to request you to help me for this problem.

    Thanks in advance and Best Regards,

    Nandar

    Thursday, May 17, 2012 7:53 AM

Answers

  • there could be many reasons:

    1. the server is behind a firewall  protecting the complete LAN network - eg. ISA, etc. - and the ports needed by SQL Server are not open
    2. you're using the wrong instancename or the name does not get solved to the correct ip of the server
    3. does the server have multiple network interfaces  and you've enabled only the one for the LAN but not the one for the public IP
    4. the connection timeout limits are to low and the connection get time out before establishing a connection.

    please check reason 3 first by checking the network interfaces on the SQL Server. If it does a network interface with the same public IP you can check if you get connection timeouts by increasing the limit in the connection dialog

    if the server does not have the public IP you need to contact your network administrator as you're definitively behind a firewall protecting your LAN.


    Please use Mark as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    Thursday, May 17, 2012 9:26 AM

All replies

  • what errors are you getting at the client?  Can you check the SQL Server error log too?


    Thanks,

    Andrew Bainbridge
    SQL Server DBA

    Please click "Propose As Answer" if a post solves your problem, or "Vote As Helpful" if a post has been useful to you

    Thursday, May 17, 2012 7:56 AM
  • Hi Andrew,

    Thanks for your reply. I got this following error when I connect to their server in SQL Server Management Studio of my PC:

    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: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.) (.Net SqlClient Data Provider)

    The way to check the SQL Server error log is at Management Studio> Management>SQL Server Log>Current. Is it correct? There is nothing error message concerning with my connection. How should I proceed? Please help me and thanks a lot.

    With Best Regards,

    Nandar

    Thursday, May 17, 2012 8:20 AM
  • Are you able to remote desktop on to the server. if you can.. open management studio and try to connect locally..

    vt


    Please mark answered if I've answered your question and vote for it as helpful to help other user's find a solution quicker

    Thursday, May 17, 2012 8:31 AM
  • Hi v.vt,

    My program will be used to connect the server on different network , not in the same network (LAN).

    Thanks and Regards,

    Nandar

    Thursday, May 17, 2012 8:44 AM
  • once you've tried vt's suggestion, double check that you've got the servername\instancename correct when connecting via SSMS.  If you've changed the port SQL Server's listening on, you could try connecting to: servername,1433



    Thanks,

    Andrew Bainbridge
    SQL Server DBA

    Please click "Propose As Answer" if a post solves your problem, or "Vote As Helpful" if a post has been useful to you

    Thursday, May 17, 2012 8:45 AM
  • No.. My question is, are you able to remote desktop on the server using Remote Desktop connection are using any other tools..

    VT


    Please mark answered if I've answered your question and vote for it as helpful to help other user's find a solution quicker


    Thursday, May 17, 2012 8:49 AM
  • I've already checked whether the server name is correct or not by this query on the server machine's SSMS

    SELECT CONVERT(char(20), SERVERPROPERTY('servername'));

    The server name is correct. I still cannot connect to the remote sql server by using servername,1433 also :(

    I can connect the servers in my same network (LAN) but cannot in different network. I don't know the methods to solve this issue anymore.

    Thanks and Regards,

    Nandar

    Thursday, May 17, 2012 9:00 AM
  • there could be many reasons:

    1. the server is behind a firewall  protecting the complete LAN network - eg. ISA, etc. - and the ports needed by SQL Server are not open
    2. you're using the wrong instancename or the name does not get solved to the correct ip of the server
    3. does the server have multiple network interfaces  and you've enabled only the one for the LAN but not the one for the public IP
    4. the connection timeout limits are to low and the connection get time out before establishing a connection.

    please check reason 3 first by checking the network interfaces on the SQL Server. If it does a network interface with the same public IP you can check if you get connection timeouts by increasing the limit in the connection dialog

    if the server does not have the public IP you need to contact your network administrator as you're definitively behind a firewall protecting your LAN.


    Please use Mark as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    Thursday, May 17, 2012 9:26 AM
  • Hi Daniel,

    Thanks for your suggestion points.

    Please let me check with the IT technician at the server site first. I suspect the first and third steps. I will let you all know the status of my problem in the forum.

    Thanks all and Regards,

    Nandar

    Thursday, May 17, 2012 9:48 AM
  • I have had the same issues. Basically, Option 1 mentioned above resolved my issues. Although port 1433 was listening on my network. I also had to create a rule in windows firewall for port 1433 and checked the domain option, because I am on a domain. Please do not check "public".
    Friday, October 05, 2012 1:40 AM