1.JAVA public void getHost(){ try { InetAddress inetAddr = InetAddress.getLocalHost(); byte[] addr = inetAddr.getAddress(); // Convert to dot representation String ipAddr = ""; for (int i = 0; i < addr.length; i++) { if (i > 0) { ipAddr += "."; } ipAddr += addr[i] & 0xFF; } System.out.println(ipAddr); } catch (UnknownHostException e) { System.out.println("Host not found: " + e.getMessage()); } }
2.oracle sql
select utl_inaddr.get_host_address db_server_ip from dual;