Null value when reading from mysql

Four Stars

Null value when reading from mysql

Hi all,

 

I want to assign a single value from mysql to a context variable using the following job:

 

tMysqlinput --> max_finding1(main) --> tJava (a screenshot is also attached)

 

tMysqlinput  returns only one value:

"select max(id) as mysql_finding_id from finding;"

 

 tJava :

System.out.println(max_finding1.mysql_finding_id);
context.db_id=max_finding1.mysql_finding_id;

 

but I'm getting a null value as a result. while printing the result to a log, I can see the corrected value.

 

Do someone knows why I get null?

 

Thanks

 


Accepted Solutions
Highlighted
Forteen Stars

Re: Null value when reading from mysql

@Emmaber,you need to re-design a job that  below way.

 

tMysqlinput-->tSetGlobalvar

-->on Subjob then put tJava and pint the global variable value.

 

to know more about tSetGlobalvar use below link.

https://help.talend.com/reader/WWQ40R_iTE5~~9VkUQrjgQ/xx0nz4uGJnqyc7dKOLN4Wg

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.

All Replies
Highlighted
Forteen Stars

Re: Null value when reading from mysql

@Emmaber,you need to re-design a job that  below way.

 

tMysqlinput-->tSetGlobalvar

-->on Subjob then put tJava and pint the global variable value.

 

to know more about tSetGlobalvar use below link.

https://help.talend.com/reader/WWQ40R_iTE5~~9VkUQrjgQ/xx0nz4uGJnqyc7dKOLN4Wg

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Four Stars

Re: Null value when reading from mysql

It works, thank you Smiley Happy

Forteen Stars

Re: Null value when reading from mysql

You are welccoem!!,Kudos also accepted.

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.

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

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

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now

How OTTO Utilizes Big Data to Deliver Personalized Experiences

Read about OTTO's experiences with Big Data and Personalized Experiences

Blog