Forum Discussion

Karthik12's avatar
Karthik12
Post Patron
1 year ago

Connecting MS SQL with hostname\database

Hello Team,

I am trying to get date from SQL server database. My machine and remote machine connected in the same network.

When I try to put IPV4 address\sql instance name, it is successfull to connect the data base and I can load. 

 

But problem is when I try to put hostname istead of IP address the problem is not connected.

 

Please support to guide me how to establish connection with hostname instead of IP address.

 

5 Replies

  • Karthik12 

     

    So the hostname INDLT-6SYSTIT has the IP address 10.28.x.x ?

     

    Open a command prompt and type ping INDLT-6SYSTIT to confirm this.

     

    The replies you get after using that ping command will tell you the IP address your computer is using to connect to INDLT-6SYSTIT

     

    If that IP address isn't the one you expect i.e. 10.28.x.x then there's an issue with the DNS name resolution on your computer.  That could be down to several things but first off check your DNS server is correct and that its records are correct.

     

    Phil

  • Hi PhilipTreacy 

    Thank you very much for your time. I have done the same.

    I have done the same in cmd.

    IP address ping is sucessfull and hostname ping is not successfull (Lost 100%).

     

     

    May I know how to setup DNS resolution?

     

     

    • PhilipTreacy's avatar
      PhilipTreacy
      Super User

      Hi Karthik12 

       

      OK, firstly, is it necessary to use the hostname to connect?  if the IP address works, why not just continue with that?

       

      DNS resolution should work via your company DNS servers.  I assume you are doing this from inside your business?  If not, where did the hostname come from?

       

      You can aso use an entry in your hosts file, but again, why not just stick with the IP address if it works?

       

      To add an entry to your hosts file check this article for instructions

       

      How to Add a Local DNS Lookup to Hosts File (helpdeskgeek.com)

       

      Regards

       

      Phil

       

      • Karthik12's avatar
        Karthik12
        Post Patron

        Hi PhilipTreacy 

        The problem is am using IP address inside a business. Mine and remote host connected to a same business wifi and these IPs are dynamic and it used to change on daily basis. 

        I am facing connection issues everyday and I used to go to remote PC and note down the IP address then used to change data source option daily.

         

        That's why I wanted to use hostname.