Five Stars

Exporting environmental variables through shell script for talend job

I am using the below shell script to run a job in Talend.

export DATE=`date +%Y%m%d`
./job1.sh

but i receive the below error:

Processing Date : null
Exception in component tMysqlInput_2 (job1)
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:542)
at java.lang.Integer.parseInt(Integer.java:615)

  • Data Integration
4 REPLIES
Eleven Stars TRF
Eleven Stars

Re: Exporting environmental variables through shell script for talend job

Can you share tMysqlInput_2 configuration or other component configuration which interact with the environment variable?

TRF
Five Stars

Re: Exporting environmental variables through shell script for talend job

Hi this issue occurs only while running it on a linux sever but in talend
studio error does not occur.
Five Stars

Re: Exporting environmental variables through shell script for talend job

This job works in talend studio, in windows as a batch script but not in linux.

I changed my variable and now I am able to see the date but still face an error:

script:

export DATE=`date +%Y%m%d`
./job1.sh

output:

Processing Date : 20170828
Exception in component tMysqlInput_2 (job1)
"ava.lang.NumberFormatException: For input string: "20170828
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)

Five Stars

Re: Exporting environmental variables through shell script for talend job

The input reads data WHERE Date="+Integer.parseInt(System.getenv(DATE))