开发者

machine name instead of ipaddress in jdbc thin driver

开发者 https://www.devze.com 2023-03-07 19:16 出处:网络
HI, Is it possible to give the machine name instead of ipaddress for jdbc thin drive开发者_开发技巧r. Or it will produce some kind of error at run time. I try machine name instead of localhost and it

HI, Is it possible to give the machine name instead of ipaddress for jdbc thin drive开发者_开发技巧r. Or it will produce some kind of error at run time. I try machine name instead of localhost and it is working.So if we can give machine name instead of ipaddress how it works


You can use a hostname instead of an IP address, but there are a few things you have to be careful about.

First of all, your computer can't "know" what hosts are mapped to what IP addresses. You use a hosts file to define these mappings. This will depend on whether you're using *nix or Windows, but the principle is the same.

Second, be aware that, even if you do map a hostname to an IP address and use that hostname in your JDBC driver connection, this will break on another machine that doesn't have the same mapping, so portability could be an issue.

If your DNS can resolve the hostname every time, then this can be another route to go.


You can certainly give its name, given that it's either present in your host file or DNS server.


The network maintains a table in which the name is mapped to the IP address. Hence you can use it.

And also this link will help you understand it. Click Here


If there's a DNS system that resolves the machine name to the appropriate IP Address, then you're safe. Otherwise, you'll most probably face a ConnectException.

0

精彩评论

暂无评论...
验证码 换一张
取 消