How to pass variable to tMysqlInput?

Seven Stars

How to pass variable to tMysqlInput?

Hi Talend Community,

 

I have a job that needs to do the following:

extract data variable from table -> Iterate row-> select new data set based on variable input.

Here is my current job

dbjob.PNG

Here is my tMysqlInput_2 select:

"select  result from details where customerid ="+((String)globalMap.get("row1.customer"))

 

When I execute I get the following error

Exception in component tMysqlInput_2
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'AF214DS' in 'where clause'

It seems to be replacing the variable with the column name....


Accepted Solutions
Highlighted
Fifteen Stars TRF
Fifteen Stars

Re: How to pass variable to tMysqlInput?

Change the expression to build the SQL query, because value must be enclosed between '' :

"select  result from details where customerid = '"+((String)globalMap.get("row1.customer"))+"'"

TRF

All Replies
Highlighted
Fifteen Stars TRF
Fifteen Stars

Re: How to pass variable to tMysqlInput?

Change the expression to build the SQL query, because value must be enclosed between '' :

"select  result from details where customerid = '"+((String)globalMap.get("row1.customer"))+"'"

TRF

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

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

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Talend Integration with Databricks

Take a look at this video about Talend Integration with Databricks

Watch Now