Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: is there a way to get the server MAC address through sql statement ?

Re: is there a way to get the server MAC address through sql statement ?

From: srivenu <srivenu_at_hotmail.com>
Date: 26 Feb 2004 02:08:43 -0800
Message-ID: <1a68177.0402260208.72882f33@posting.google.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US