I have a flow which reads a CSV files and perfrorm CRUD operation in database ... My flow is somewhat like :-
<flow name="CsvToFile" doc:name="CsvToFile">
<file:inbound-endpoint path="C:\Data" responseTimeout="10000" doc:name="CSV" connector-ref="File">
<file:filename-wildcard-filter pattern="*.csv" caseSensitive="true"/>
</file:inbound-endpoint>
<jdbc-ee:csv-to-maps-transformer delimiter="," mappingFile="src/main/abc.xml" ignoreFirstRecord="true" doc:name="CSVTransformer"/>
<jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="SelectQuery" queryTimeout="-1" connector-ref="jdbcConnectorGlobal" doc:name="Database">
<jdbc-ee:query key="SelectQuery" value="Select * FROM DBDATA where ID=#[map-payload:ID]"/>
</jdbc-ee:outbound-endpoint>
<set-payload value="#[message.payload]" doc:name="Set Payload"/>
</flow>
Now if I use SELECT
SQL statement.. I don't see the result and no data is fetched ... but if I use INSERT
like
<jdbc-ee:query key="InsertQuery" value="INSERT INTO DBDATA (ID,NAME,AGE) VALUES(#[map-payload:ID],#[map-payload:NAME],#[map-payload:AGE])"/>
or an UPDATE
SQL statement, I can find it's working and data is inserted or updated in dataase.
My question is: how can I read the ID
value from .CSV
file and use in SELECT
query to retrieve values from the database?