I need to find out the Windows username using SQL, PL/SQL or Java. So far I've found some java code that can return a Windows username. I put the Java code in my schema database, but can't create a function that will call this Java code.
So, my question is:
How can I write an SQL function that will call this Java code below?
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED TED."`GetWindowUsername`" as import java.`lang`.*;
import java.`util`.*;
import java.`io`.*;
public class `GetWindowUsername` {
public static final void main( String `args`[] ) {
String `userName` = System.get Property("user.name");
System.out.`println`("Window's Username: "+user Name);
}
}
I found this code on the internet as an example for getting Windows username.
I'm using Oracle Toad as a tool for SQL coding.