Hi, I am using Camel 2.9 and Spring 3.1

I have been using the jdbc component to perform (transacted) inserts into my
database.  It has been working well.  However, there is a new test object in
the message that needs to be inserted into a Clob.

There isn't much information about using camel to insert Clobs.  I found
this thread which suggests using a DAO and Spring JdbcTemplate.  
(http://camel.465427.n5.nabble.com/Insert-into-CLOB-Column-in-Oracle-using-JDBC-Component-td4667458.html#a4673824)

There is plenty of information about using a JdbcTemplate to insert a Clob,
but I am unclear how to integrate this into my camel route.

Currently, I have a routes that load a pojo (from an xml file and from JMS). 
The file route looks like:

<camel:route>
   <camel:from uri="file:/events/"/>
   <camel:bean ref="myEventBean" method="fromXML"/>   <-- load the bean and
headers from XML
   <camel:bean ref="myEventBean" method="toJDBC"/>      <-- converts bean
attributes to jdbc
   <camel:to uri="jdbc:myDatabase"/>
</camel:route>

<camel:route>
   <camel:from uri="activemq:queue:events"/>
   <camel:transacted/>
   <camel:bean ref="myEventBean" method="fromHeaders"/>   <-- load the bean
and headers
   <camel:bean ref="myEventBean" method="toJDBC"/>      <-- converts bean
attributes to jdbc
   <camel:to uri="jdbc:myDatabase"/>
</camel:route>

It seems like I need to:
- Define a JDBCTemplate in my (application context).xml file,
- Change the toJDBC method (or create a new one) that uses that new template
to insert the Clob
- Get rid of the jdbc endpoint.

Does this seem correct?  Is there a better way to work with Clobs?  Also,
note the activemq route is transacted.  Does implementing the JdbcTemplate
in my pojo break the transaction?  

JdbcTemplate examples I found:
http://static.springsource.org/spring/docs/2.5.x/reference/jdbc.html
http://www.java2s.com/Code/Java/Spring/InsertClobData.htm

Thanks for any insight,
-J


--
View this message in context: 
http://camel.465427.n5.nabble.com/Using-Camel-with-JDBCTemplate-for-Clob-tp5715810.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to