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
Forteen Stars TRF
Forteen 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
Forteen Stars TRF
Forteen 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

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.