2. Transfer data from CSV File to Database
Topics :
• How to work with Mule and transfer data from CSV file to database
Pre-requisites :
• Basic under standing of Mule ESB
• JDK 1.8 or above
• Anypoint Studio v 6.0.0 or above
• MySQL connector
• Mule Server v 3.8.0 EE or above
• Create database & Schema or use existing one
5. Component details
• File : Define Source Path and Move to Directory with Polling frequency
• Transformer ( Object to String ) : Nothing to do here, as it converts object to String internally
• Splitter : Split multiples records (#[StringUtils.split(message.payload, 'nr')] )
• Expression : comma separated record (#[StringUtils.split(message.payload, ',')] )
• Choice : Validating the first row to make sure that there is no header, as expected in the CSV file.
CSV File contains only related data and do not expect to have header row.
• Valid condition: Invoke the Database insert flow
• Default condition : Do not perform any action – Default logging.
• DB Insert Flow: Each single record will be inserted into Database.