Discussion:
JDBC Retrival and tag.
AKILKARTHIK AKILKARTHIK
2012-02-15 12:28:14 UTC
Permalink
Once we get the data from the DB i had to write the data into XML format.. but how to i add the tags in tat xml file!!!!

this is my code!!!


<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:spring="http://www.springframework.org/schema/beans" xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:xm="http://www.mulesoft.org/schema/mule/xml" xmlns:jdbc="http://www.mulesoft.org/schema/mule/ee/jdbc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:stdio="http://www.mulesoft.org/schema/mule/stdio"

xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.2/mule-vm.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/3.2/mule-xml.xsd
http://www.mulesoft.org/schema/mule/stdio http://www.mulesoft.org/schema/mule/stdio/3.2/mule-stdio.xsd
http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/3.2/mule-jdbc-ee.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/3.2/mule-file.xsd">


<spring:bean id="jdbcDataSource" class="org.enhydra.jdbc.standard.StandardDataSource" destroy-method="shutdown">
<spring:property name="driverName" value="oracle.jdbc.driver.OracleDriver"/>
<spring:property name="url" value="@@@@@@@@@@@@:"/>
</spring:bean>


<jdbc:connector name="jdbcConnector" dataSource-ref="jdbcDataSource">
<jdbc:query key="selectEmployee"
value="select * from TABLENAME where CONDITION='Data'"/>
</jdbc:connector>

<xm:object-to-xml-transformer name="ToXML"/>

<flow name="processCustomers">

<jdbc:inbound-endpoint queryKey="selectEmployee"/>

<log-component/>


<!-- <byte-array-to-string-transformer name="ByteArrayToString" />
<stdio:outbound-endpoint system="OUT" exchange-pattern="one-way"/>-->
<file:outbound-endpoint path="C:\Desktop\input" outputPattern="newOutput.xml" transformer-refs="ToXML"/>
</flow>

</mule>

the out put file was as give Below:

org.mule.util.CaseInsensitiveHashMap serialization="custom">
<unserializable-parents/>
<org.mule.util.CaseInsensitiveHashMap>
<default/>
<float>0.75</float>
<int>16</int>
<int>6</int>
<string>PM_NAME</string>
<string>Mohan</string>
<string>ASSOCIATE_NAME</string>
<string>Harish</string>
<string>ASSOCIATE_ID</string>
<big-decimal>303250</big-decimal>
<string>PROCESSED</string>
<string>Y</string>
<string>PM_ID</string>
<big-decimal>101121</big-decimal>
<string>COMPANY_NAME</string>
<string>XYZ</string>
</org.mule.util.CaseInsensitiveHashMap>
</org.mule.util.CaseInsensitiveHashMap>

I need to get like this :
<associate-name> Mohan<\associate-name>
<proccessed> y <\Proccessed>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Andrew Perepelytsya
2012-02-15 15:59:33 UTC
Permalink
If the xml file is not very complex, you can e.g. create a groovy string
template and write values like $message.getInboundProperty(' myPropName').

Andrew
On Feb 15, 2012 7:28 AM, "AKILKARTHIK AKILKARTHIK" <
Post by AKILKARTHIK AKILKARTHIK
Once we get the data from the DB i had to write the data into XML format..
but how to i add the tags in tat xml file!!!!
this is my code!!!
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:xm="http://www.mulesoft.org/schema/mule/xml" xmlns:jdbc="
http://www.mulesoft.org/schema/mule/ee/jdbc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:stdio="
http://www.mulesoft.org/schema/mule/stdio"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
http://www.mulesoft.org/schema/mule/vm
http://www.mulesoft.org/schema/mule/vm/3.2/mule-vm.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/xml
http://www.mulesoft.org/schema/mule/xml/3.2/mule-xml.xsd
http://www.mulesoft.org/schema/mule/stdio
http://www.mulesoft.org/schema/mule/stdio/3.2/mule-stdio.xsd
http://www.mulesoft.org/schema/mule/ee/jdbc
http://www.mulesoft.org/schema/mule/ee/jdbc/3.2/mule-jdbc-ee.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.mulesoft.org/schema/mule/file
http://www.mulesoft.org/schema/mule/file/3.2/mule-file.xsd">
<spring:bean id="jdbcDataSource"
class="org.enhydra.jdbc.standard.StandardDataSource"
destroy-method="shutdown">
<spring:property name="driverName"
value="oracle.jdbc.driver.OracleDriver"/>
</spring:bean>
<jdbc:connector name="jdbcConnector" dataSource-ref="jdbcDataSource">
<jdbc:query key="selectEmployee"
value="select * from TABLENAME where
CONDITION='Data'"/>
</jdbc:connector>
<xm:object-to-xml-transformer name="ToXML"/>
<flow name="processCustomers">
<jdbc:inbound-endpoint queryKey="selectEmployee"/>
<log-component/>
<!-- <byte-array-to-string-transformer
name="ByteArrayToString" />
<stdio:outbound-endpoint system="OUT"
exchange-pattern="one-way"/>-->
<file:outbound-endpoint path="C:\Desktop\input"
outputPattern="newOutput.xml" transformer-refs="ToXML"/>
</flow>
</mule>
org.mule.util.CaseInsensitiveHashMap serialization="custom">
<unserializable-parents/>
<org.mule.util.CaseInsensitiveHashMap>
<default/>
<float>0.75</float>
<int>16</int>
<int>6</int>
<string>PM_NAME</string>
<string>Mohan</string>
<string>ASSOCIATE_NAME</string>
<string>Harish</string>
<string>ASSOCIATE_ID</string>
<big-decimal>303250</big-decimal>
<string>PROCESSED</string>
<string>Y</string>
<string>PM_ID</string>
<big-decimal>101121</big-decimal>
<string>COMPANY_NAME</string>
<string>XYZ</string>
</org.mule.util.CaseInsensitiveHashMap>
</org.mule.util.CaseInsensitiveHashMap>
<associate-name> Mohan<\associate-name>
<proccessed> y <\Proccessed>
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
stefano.falconetti
2012-02-16 14:40:56 UTC
Permalink
Thank you for your message. I'm sorry, I'm currently out of office with no access to e-mails. If your query is urgent you can try to contact me on my mobile: +39 335 1990013. I will be back on 17/02/2012 Regards, Stefano Falconetti.

If you are not the intended recipient of this e-mail message, please notify the sender
and delete all copies immediately. The sender believes this message and any attachments
were sent free of any virus, worm, Trojan horse, and other forms of malicious code.
This message and its attachments could have been infected during transmission. The
recipient opens any attachments at the recipient's own risk, and in so doing, the
recipient accepts full responsibility for such actions and agrees to take protective
and remedial action relating to any malicious code. Travelport is not liable for any
loss or damage arising from this message or its attachments.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Pablo La Greca
2012-02-15 16:52:13 UTC
Permalink
Hi,

Once your read information from a DB using a jdbc inbound endpoint the information is located as the payload in a Map. So for each column you will have an entry in your Map.

I suggest you create a custom transformer which returns the xml accessing the information from the payload which is the map will all the information.

HTH, Pablo.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
AKILKARTHIK AKILKARTHIK
2012-02-16 03:35:27 UTC
Permalink
can u tell me still more how this can be done... Is the above code is fine??? .. can u tell me were exactly u need change in the above code!!!
It will help me out if u jst put me sample code by considering the above code!!!!! plzzzzzz!!!!!

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Loading...