H2는 여러 네트워크 인터페이스를 어떻게 처리합니까? 현재 IP가있는 두 개의 인터페이스가 발견되면 오류 메시지를 반환하는 getOwnIpAddress 함수를 사용하여 한 컴퓨터에서 두 개의 ips를 사용할 수 없습니다.H2 다중 네트워크 인터페이스
private String getOwnIpAddress()
{
ArrayList<String> ipAddresses = new ArrayList<>();
try
{
/*find out my own ip address*/
Enumeration<NetworkInterface> networkInterfaces;
networkInterfaces = NetworkInterface.getNetworkInterfaces();
for (NetworkInterface netint : Collections.list(networkInterfaces))
{
Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();
for (InetAddress inetAddress : Collections.list(inetAddresses))
{
if (isIPAddress(inetAddress.getHostAddress())
&& !inetAddress.getHostAddress().equals("127.0.0.1"))
{
ipAddresses.add(inetAddress.getHostAddress());
}
}
}
if (ipAddresses.size() > 1)
{
DialogMessage.showMessage(null, Resource.getResourceString("tooManyInterfacesError"), "",
JOptionPane.ERROR_MESSAGE);
Main.quit();
}
else if (ipAddresses.size() > 0)
{
return ipAddresses.get(0);
}
else
{
return null;
}
}
catch (SocketException ex)
{
ex.printStackTrace();
}
return null;
}
H2가 하나의 IP를 선호하도록 할 수 있습니까? 또는 auto_server 모드에서 H2로 처리 할 수 있습니까?
이것이 도움이 될지 모르겠지만 시스템 속성'h2.bindAddress'를 사용해 보셨습니까? [the javadocs] (http://h2database.com/javadoc/org/h2/constant/SysProperties.html#h2.bindAddress)도 참고하십시오. –