Six Stars

How to capture UserName of Talend Studio

Hello,

 

I have requirement wherein I have to capture Talend username in a String variable / input_row(tJavaRow) which will be passed further in a table (Mysql) for logging purpose, to identify job was executed from whose machine.

 

Any idea on how we can achieve this in Talend?

1 ACCEPTED SOLUTION

Accepted Solutions
Seven Stars

Re: How to capture UserName of Talend Studio

In your tJavaRow code you could put either of the code block to get the current Windows User Name -

String userName = System.getProperty("user.name");
System.out.println(userName);
com.sun.security.auth.module.NTSystem NTSystem = new com.sun.security.auth.module.NTSystem();
userName = NTSystem.getName();
System.out.println(userName);
2 REPLIES
Seven Stars

Re: How to capture UserName of Talend Studio

In your tJavaRow code you could put either of the code block to get the current Windows User Name -

String userName = System.getProperty("user.name");
System.out.println(userName);
com.sun.security.auth.module.NTSystem NTSystem = new com.sun.security.auth.module.NTSystem();
userName = NTSystem.getName();
System.out.println(userName);
Six Stars

Re: How to capture UserName of Talend Studio

It worked, Thanks Abhishek!