how print a query for debugging

Highlighted
One Star

how print a query for debugging

Hi to all.
I have an error writing into my AS400 db, but I can't find what's wrong in my job.
I tried to print the sql statement (System.out.println(((String)globalMap.get("tAS400Output_1_QUERY")))Smiley Wink but it's null.
How can I debug my job?
All fields have the same type and lenght.
Help me please.
Exception in component tAS400Output_1
java.lang.RuntimeException: Execution failure, there might be an error in your SQL syntax.
at cps_corsi.corsi_formazione_0_1.Corsi_Formazione.tMSSqlInput_1Process(Corsi_Formazione.java:3071)
at cps_corsi.corsi_formazione_0_1.Corsi_Formazione.tMSSqlConnection_1Process(Corsi_Formazione.java:701)
at cps_corsi.corsi_formazione_0_1.Corsi_Formazione.tRunJob_1Process(Corsi_Formazione.java:579)
at cps_corsi.corsi_formazione_0_1.Corsi_Formazione.runJobInTOS(Corsi_Formazione.java:5237)
at cps_corsi.corsi_formazione_0_1.Corsi_Formazione.runJob(Corsi_Formazione.java:5097)

Thanks

Gisella
Highlighted
Community Manager

Re: how print a query for debugging

Hi
I tried to print the sql statement (System.out.println(((String)globalMap.get("tAS400Output_1_QUERY")))wink but it's null.

It is normal, because we don't set a value to global variable globalMap.get("tAS400Output_1_QUERY"), so it is null.
If you know Java, you can go to the debug model and print the query.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Highlighted
Seven Stars

Re: how print a query for debugging

So can I ask why globalMap.get("tAS400Output_1_QUERY") exists at all if it's never populated? Is that the case for all tOutput components: that their tOutput_1_QUERY globalMap variable is not populated? (Also see this post).
Highlighted
One Star

Re: how print a query for debugging

Thanks Shong.
I printed the query as you show me, I filled and executed it manually: all works.
But still I have some talend exception
Exception in component tAS400Output_1
java.lang.RuntimeException: Execution failure, there might be an error in your SQL syntax.
at cps_corsi.corsi_formazione_0_1.Corsi_Formazione.tMSSqlInput_1Process(Corsi_Formazione.java:2134)
at cps_corsi.corsi_formazione_0_1.Corsi_Formazione.tAS400Connection_2Process(Corsi_Formazione.java:552)
at cps_corsi.corsi_formazione_0_1.Corsi_Formazione.tMSSqlConnection_2Process(Corsi_Formazione.java:3293)
I found that this error is throws when is used an existing connection.
Specifying the connection params all works well.
May be it's a bug? I'm using talend 3.2.2.
Gisella

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

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog