How to capture UserName of Talend Studio

Seven 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);

View solution in original post


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);

View solution in original post

Highlighted
Seven Stars

Re: How to capture UserName of Talend Studio

It worked, Thanks Abhishek!

2019 GARTNER 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

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog