Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: is there a way to get the server MAC address through sql statement ?
Try this out.
I tested it out on 2000 you need to make some changes for Unix.
I had taken the basic concept from ASKTOM.
create or replace and compile
java source named "Util"
as
import java.io.*;
import java.lang.*;
public class Util extends Object
{
public static int RunThis()
{
Runtime rt = Runtime.getRuntime();
int rc = -1;
try
{
Process p = rt.exec("arp -a");
int bufSize = 4096;
BufferedInputStream bis =
new BufferedInputStream(p.getInputStream(), bufSize);
int len;
byte buffer[] = new byte[bufSize];
// Echo back what the program spit out
while ((len = bis.read(buffer, 0, bufSize)) != -1)
System.out.write(buffer, 0, len);
rc = p.waitFor();
}
catch (Exception e)
{
e.printStackTrace();
rc = -1;
}
finally
{
return rc;
} } }
create or replace
function RUN_CMD return number
as
language java
name 'Util.RunThis() return integer';
/
create or replace procedure RC
as
x number;
begin
x := run_cmd;
end;
/
set serveroutput on size 1000000
exec dbms_java.set_output(1000000)
exec rc;
regards
Srivenu
Received on Thu Feb 26 2004 - 04:08:43 CST