Get host name for IP using SQL
Hi All
Kindly, I need a function to return host name with input parameter IP address for any PC in the local network,
I did the following with user SYS and it's executed without errors but returning null, please help
Note: if i change the statement from (PING or NBTSTAT) to DIR it's working and returning DIR command output
1- create Java source named Host:
create or replace and compile java source named "Host" asimport java.io.*;public class Host { public static void executeCommand(String command) { try { String[] finalCommand; if (isWindows()) { finalCommand = new String[4]; // Use the appropriate path for your windows version. //finalCommand[0] = "C:\\winnt\\system32\\cmd.exe"; // Windows NT/2000 finalCommand[0] = "C:\\windows\\system32\\cmd.exe"; // Windows XP/2003 //finalCommand[0] = "C:\\windows\\syswow64\\cmd.exe"; // Windows 64-bit finalCommand[1] = "/y"; finalCommand[2] = "/c"; finalCommand[3] = command; } else { finalCommand = new String[3]; finalCommand[0] = "/bin/sh"; finalCommand[1] = "-c"; finalCommand[2] = command; } final Process pr = Runtime.getRuntime().exec(finalCommand); pr.waitFor(); new Thread(new Runnable(){ public void run() { BufferedReader br_in =