How to capture UserName of Talend Studio

Highlighted
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?


Accepted Solutions
Nine 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);

All Replies
Nine 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!

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Downloads and Trials

Test drive Talend's enterprise products.

Downloads