Can't use DNS name instead of ip for jdbc connection on local network











up vote
0
down vote

favorite












I have the following connectionString for my db:



jdbc:sqlserver://{someIpAdress}:1433;database=db


I want to resolve someIpAdress to the DNS name instead. By running nslookup on the ip I get the name for that address. But replacing the Ip with the DNS name results in a failing connection for the jdbc connection.



I have tried modifying the file /etc/resolv.conf which now allows me to ping the DNS name, but it seems like the configuration should be done with netplan for Ubuntu 18.04LTS. Changes to interfaces in /etc/network didn't work either.



Some of the guides I've looked at so far:
https://www.cyberciti.biz/faq/howto-set-dns-search-list-for-host-name-lookup/



Any help is much appreciated










share|improve this question




























    up vote
    0
    down vote

    favorite












    I have the following connectionString for my db:



    jdbc:sqlserver://{someIpAdress}:1433;database=db


    I want to resolve someIpAdress to the DNS name instead. By running nslookup on the ip I get the name for that address. But replacing the Ip with the DNS name results in a failing connection for the jdbc connection.



    I have tried modifying the file /etc/resolv.conf which now allows me to ping the DNS name, but it seems like the configuration should be done with netplan for Ubuntu 18.04LTS. Changes to interfaces in /etc/network didn't work either.



    Some of the guides I've looked at so far:
    https://www.cyberciti.biz/faq/howto-set-dns-search-list-for-host-name-lookup/



    Any help is much appreciated










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have the following connectionString for my db:



      jdbc:sqlserver://{someIpAdress}:1433;database=db


      I want to resolve someIpAdress to the DNS name instead. By running nslookup on the ip I get the name for that address. But replacing the Ip with the DNS name results in a failing connection for the jdbc connection.



      I have tried modifying the file /etc/resolv.conf which now allows me to ping the DNS name, but it seems like the configuration should be done with netplan for Ubuntu 18.04LTS. Changes to interfaces in /etc/network didn't work either.



      Some of the guides I've looked at so far:
      https://www.cyberciti.biz/faq/howto-set-dns-search-list-for-host-name-lookup/



      Any help is much appreciated










      share|improve this question















      I have the following connectionString for my db:



      jdbc:sqlserver://{someIpAdress}:1433;database=db


      I want to resolve someIpAdress to the DNS name instead. By running nslookup on the ip I get the name for that address. But replacing the Ip with the DNS name results in a failing connection for the jdbc connection.



      I have tried modifying the file /etc/resolv.conf which now allows me to ping the DNS name, but it seems like the configuration should be done with netplan for Ubuntu 18.04LTS. Changes to interfaces in /etc/network didn't work either.



      Some of the guides I've looked at so far:
      https://www.cyberciti.biz/faq/howto-set-dns-search-list-for-host-name-lookup/



      Any help is much appreciated







      networking 18.04 dns netplan






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 at 10:12

























      asked Nov 13 at 10:06









      Øystein Seel

      2121413




      2121413






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          If you use 18.04 there is some bug of auto generate resolv.conf file. Create symlink which following command fixs this problem.



          sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf


          But if you don't have DNS server you can edit /etc/hosts



          127.0.0.1   localhost
          127.0.1.1 com01

          # The following lines are desirable for IPv6 capable hosts
          ::1 ip6-localhost ip6-loopback
          fe00::0 ip6-localnet
          ff00::0 ip6-mcastprefix
          ff02::1 ip6-allnodes
          ff02::2 ip6-allrouters

          192.168.168.88 lab01


          From above configuration com01 is your computer name 192.168.168.88 is your server IP address and lab01 is your server name.



          Hope this help.






          share|improve this answer





















          • I already have that configuration in /etc/hosts and the ln command failed since /etc/resolv.conf already exists
            – Øystein Seel
            Nov 13 at 10:47










          • Your answer tunred out to be correct. I had only provided the IP for the parent DNS, but had to manually add thoose i needed
            – Øystein Seel
            Nov 13 at 11:41










          • Just make sure that resolv.conf is linked to path /run/systemd/resolve/resolv.conf if you use 18.04. It's always not getting right DNS if it isn't linked to the path and you can remove /etc/resolv.conf in case it already exist and run command to link file again.
            – eetsurt
            Nov 13 at 11:49











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1092500%2fcant-use-dns-name-instead-of-ip-for-jdbc-connection-on-local-network%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          If you use 18.04 there is some bug of auto generate resolv.conf file. Create symlink which following command fixs this problem.



          sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf


          But if you don't have DNS server you can edit /etc/hosts



          127.0.0.1   localhost
          127.0.1.1 com01

          # The following lines are desirable for IPv6 capable hosts
          ::1 ip6-localhost ip6-loopback
          fe00::0 ip6-localnet
          ff00::0 ip6-mcastprefix
          ff02::1 ip6-allnodes
          ff02::2 ip6-allrouters

          192.168.168.88 lab01


          From above configuration com01 is your computer name 192.168.168.88 is your server IP address and lab01 is your server name.



          Hope this help.






          share|improve this answer





















          • I already have that configuration in /etc/hosts and the ln command failed since /etc/resolv.conf already exists
            – Øystein Seel
            Nov 13 at 10:47










          • Your answer tunred out to be correct. I had only provided the IP for the parent DNS, but had to manually add thoose i needed
            – Øystein Seel
            Nov 13 at 11:41










          • Just make sure that resolv.conf is linked to path /run/systemd/resolve/resolv.conf if you use 18.04. It's always not getting right DNS if it isn't linked to the path and you can remove /etc/resolv.conf in case it already exist and run command to link file again.
            – eetsurt
            Nov 13 at 11:49















          up vote
          1
          down vote



          accepted










          If you use 18.04 there is some bug of auto generate resolv.conf file. Create symlink which following command fixs this problem.



          sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf


          But if you don't have DNS server you can edit /etc/hosts



          127.0.0.1   localhost
          127.0.1.1 com01

          # The following lines are desirable for IPv6 capable hosts
          ::1 ip6-localhost ip6-loopback
          fe00::0 ip6-localnet
          ff00::0 ip6-mcastprefix
          ff02::1 ip6-allnodes
          ff02::2 ip6-allrouters

          192.168.168.88 lab01


          From above configuration com01 is your computer name 192.168.168.88 is your server IP address and lab01 is your server name.



          Hope this help.






          share|improve this answer





















          • I already have that configuration in /etc/hosts and the ln command failed since /etc/resolv.conf already exists
            – Øystein Seel
            Nov 13 at 10:47










          • Your answer tunred out to be correct. I had only provided the IP for the parent DNS, but had to manually add thoose i needed
            – Øystein Seel
            Nov 13 at 11:41










          • Just make sure that resolv.conf is linked to path /run/systemd/resolve/resolv.conf if you use 18.04. It's always not getting right DNS if it isn't linked to the path and you can remove /etc/resolv.conf in case it already exist and run command to link file again.
            – eetsurt
            Nov 13 at 11:49













          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          If you use 18.04 there is some bug of auto generate resolv.conf file. Create symlink which following command fixs this problem.



          sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf


          But if you don't have DNS server you can edit /etc/hosts



          127.0.0.1   localhost
          127.0.1.1 com01

          # The following lines are desirable for IPv6 capable hosts
          ::1 ip6-localhost ip6-loopback
          fe00::0 ip6-localnet
          ff00::0 ip6-mcastprefix
          ff02::1 ip6-allnodes
          ff02::2 ip6-allrouters

          192.168.168.88 lab01


          From above configuration com01 is your computer name 192.168.168.88 is your server IP address and lab01 is your server name.



          Hope this help.






          share|improve this answer












          If you use 18.04 there is some bug of auto generate resolv.conf file. Create symlink which following command fixs this problem.



          sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf


          But if you don't have DNS server you can edit /etc/hosts



          127.0.0.1   localhost
          127.0.1.1 com01

          # The following lines are desirable for IPv6 capable hosts
          ::1 ip6-localhost ip6-loopback
          fe00::0 ip6-localnet
          ff00::0 ip6-mcastprefix
          ff02::1 ip6-allnodes
          ff02::2 ip6-allrouters

          192.168.168.88 lab01


          From above configuration com01 is your computer name 192.168.168.88 is your server IP address and lab01 is your server name.



          Hope this help.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 at 10:37









          eetsurt

          113110




          113110












          • I already have that configuration in /etc/hosts and the ln command failed since /etc/resolv.conf already exists
            – Øystein Seel
            Nov 13 at 10:47










          • Your answer tunred out to be correct. I had only provided the IP for the parent DNS, but had to manually add thoose i needed
            – Øystein Seel
            Nov 13 at 11:41










          • Just make sure that resolv.conf is linked to path /run/systemd/resolve/resolv.conf if you use 18.04. It's always not getting right DNS if it isn't linked to the path and you can remove /etc/resolv.conf in case it already exist and run command to link file again.
            – eetsurt
            Nov 13 at 11:49


















          • I already have that configuration in /etc/hosts and the ln command failed since /etc/resolv.conf already exists
            – Øystein Seel
            Nov 13 at 10:47










          • Your answer tunred out to be correct. I had only provided the IP for the parent DNS, but had to manually add thoose i needed
            – Øystein Seel
            Nov 13 at 11:41










          • Just make sure that resolv.conf is linked to path /run/systemd/resolve/resolv.conf if you use 18.04. It's always not getting right DNS if it isn't linked to the path and you can remove /etc/resolv.conf in case it already exist and run command to link file again.
            – eetsurt
            Nov 13 at 11:49
















          I already have that configuration in /etc/hosts and the ln command failed since /etc/resolv.conf already exists
          – Øystein Seel
          Nov 13 at 10:47




          I already have that configuration in /etc/hosts and the ln command failed since /etc/resolv.conf already exists
          – Øystein Seel
          Nov 13 at 10:47












          Your answer tunred out to be correct. I had only provided the IP for the parent DNS, but had to manually add thoose i needed
          – Øystein Seel
          Nov 13 at 11:41




          Your answer tunred out to be correct. I had only provided the IP for the parent DNS, but had to manually add thoose i needed
          – Øystein Seel
          Nov 13 at 11:41












          Just make sure that resolv.conf is linked to path /run/systemd/resolve/resolv.conf if you use 18.04. It's always not getting right DNS if it isn't linked to the path and you can remove /etc/resolv.conf in case it already exist and run command to link file again.
          – eetsurt
          Nov 13 at 11:49




          Just make sure that resolv.conf is linked to path /run/systemd/resolve/resolv.conf if you use 18.04. It's always not getting right DNS if it isn't linked to the path and you can remove /etc/resolv.conf in case it already exist and run command to link file again.
          – eetsurt
          Nov 13 at 11:49


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1092500%2fcant-use-dns-name-instead-of-ip-for-jdbc-connection-on-local-network%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

          ComboBox Display Member on multiple fields

          Is it possible to collect Nectar points via Trainline?