Use JDBC to access Oracle, that is, when java connects to the local database, the address can be localhost or 127.0.0.1. But what is the difference between the two? Which one is better? Many people think that these two are completely the same, and some people think 127.0.0.1 is better, because it is a local IP address and does not need to be resolved from the domain name. In fact, these two are very different: localhost
Use JDBC to access Oracle, that is, when java connects to the local database, the address can be localhost or 127.0.0.1. But what is the difference between the two? Which one is better? Many people think that these two are completely the same, and some people think 127.0.0.1 is better, because it is a local IP address and does not need to be resolved from the domain name. In fact, these two are very different: localhost
Use JDBC to access Oracle, that is, when java connects to the local database, the address can be localhost or 127.0.0.1. But what is the difference between the two? Which one is better?
Many people think that these two are completely the same, and some people think 127.0.0.1 is better, because it is a local IP address and does not need to be resolved from the domain name. In fact, these two are very different:
Localhost is also called local. The correct explanation is: local server
The correct explanation of 127.0.0.1 in the system is: local address (local server)
Localhot (local) is transmitted without a Nic! This is important because it is not restricted by network firewalls and network adapters. Access to localhost will not be resolved to an ip address, and will not occupy Nic or network resources.
127.0.0.1 depends on the network card and is restricted by the network firewall and network card.
This is why it is sometimes accessible using localhost, but not 127.0.0.1.
So use localhost whenever possible.