How to capture UserName of Talend Studio

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!

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Download