One Star

[resolved] Reading databases with parameters?

Hi there,
I want to create a simple web service which receives a "contract date" as one of the request parameters.
The service shall then simply read contracts from a contract table where the above mentioned contract date is greater or equal to the ones in the database.
In other words:
select * from contracts where contract_date < "contract date"
How do I do that in talend?
How can I use request parameters of a web service call as filter parameters of a SQL where clause?
Thanks
Matt
3 REPLIES
Four Stars

Re: [resolved] Reading databases with parameters?

Hi Matt,
After receiving parameter from web service, assign that value to context variable... and then use that context variable in your sql query..
"select * from contracts where contract_date < "+contex.contract date
Try this... Be careful about format and datatype conversion using proper enclosures.. Use print statement to ensure correctness of the query.
vaibhav
One Star

Re: [resolved] Reading databases with parameters?

Thanks, sanvaibhav, I followed your advice and it works. Even though I think, Talend makes handling this triviality too complex :-)
Four Stars

Re: [resolved] Reading databases with parameters?

Yes, I knew.. Many could not proceed further due to this problem for many days in early stages...
vaibhav