If we now look into the tblFamily, we will find that 5 records has been inserted We are now almost done.Next we need to run the application.Right click on "JDBC-PostgreSQL-Mule-Experiment.mflow" and from the context menu, choose Run As->Mule Application. The full configuration XML should look like In the last step, we push the records to the PostgreSQL Database which is the "Database" component (Outbound). In the third step, we basically parse the XML file value by using the "Splitter" component.We specify a valid Mule XPath expression for the purpose. In the second step, we basically convert between byte arrays and strings by using the "byte-array-to-string-transformer" It is quite simple.At the first step, we basically use the "File" component(InBound) to locate the XML file. Switch to the "Configuration XML" tab first and add the below piece of code just after the "" If at this stage we view the "Configuration XML" tab, it will look like ('//FirstName').text],#)įinally, we will be presented with the below screen if everything has gone right so far INSERT INTO "tblFamily"("Title", "FirstName", "LastName") VALUES (#,#[xpath First we need to specify the "Query Key"(which is "Insert Record" here) and then the query as shown under.Click "OK" button. (c)Switch to the "Queries" tab and click on the button ("Add Query"). (b)From the Database Window that appears, click on the "Database Specific" dropdown and choose "PostgreSQL_Data_Source".It is the Data-Source that we created in the previous step (a)Click on the "Create" button.Look for Connector > Database.Then click OK. So we have successfully created a DataSource with it's proper driver.Now we need a Connector. (d)In that, we need to specify the Database name in the URL section, PostgreSQL User Name in the "User" field and Password in "Password" field and click OK. (c)The PostgreSQL Data Source Window appears (b)Click on the "Create" button.Look for Data Sources > PostgreSQL Data Source and click the OK button. Step 3: Now the time for creating DataSource This will allow us to create an instance of the Object driver (c)Now we can find the jar file being present in the "Referenced Libraries" of the package explorer. (b)Choose the location where the "" jar file is located in the hard drive and then click on the "Open" button. (a)In the Package Explorer, right-click over the Project folder ( in this case "jdbc-postgresql-mule-experiment)- >BuildPath->Add External Archives… Use proper JRE version that you are using.Ĭlick "Next" button and "Java Settings" window appears.Leave it as it is.Click "Finish" button.We will be presented with the following Workspace is the location where we need to work for the project.Ĭlick on "OK" button to receive the Mule Studio window.Click on "Go to Mule Studio".We will receive the Mule studio editor.Ĭlick File > New > Mule Project.From the "New Mule Project" window that appears, populate the "Name" field with "JDBC-PostgreSQL-Mule-Experiment".Ĭlick "Next" button and "New Mule Flow" window appears.Click "Next" button and "New Mule Flow" window appears.Leave it as it is.Click "Next" button and "Create New Java Project" window appears. So now we are all set to do our first example using Mule Studio.Execute the "MuleStudio.exe" and enter a location for creating the workspace. Everything should be up and running properly.Table Creation ScriptĪ CSV file from where the data needs to be read.The CSV file structure will be as under What we need to have for doing the experiment?Ī database to be created in PostgreSQL say "TestDB" where atleast one Table say "tblFamily" should be created. In the last article we saw how to use Mule Studio for reading CSV Data from File(Inbound) and write it to PostgreSQL (Outbound).In this article we will look into reading XML Data from File(Inbound) and write it to PostgreSQL (Outbound). Using Mule Studio to read XML Data from File(Inbound) and write it to PostgreSQL (Outbound) - Step by Step approach
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |