camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brbornia <brbor...@gmail.com>
Subject Need help to load csv into database
Date Wed, 07 Mar 2012 22:02:23 GMT
Hello guys,

I'm just starting with camel, so sorry to bother you with a must likely
dummy question.

I am trying to load a csv file into database with something like this:

<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
    <camel:package>com.test.integration.camel.spring.poc</camel:package>
    <camel:route>
	<camel:from uri="file:/media/arq/work/workspace/servicemix/datafeed/from/>
	<camel:split streaming="true" parallelProcessing="true">
	    <camel:tokenize token="\n" />
	    <camel:split>
		<camel:tokenize token=","/>
		<camel:to
			uri="sql:INSERT INTO mytable (id, name, event, time) 
			VALUES (#, #, #, #)?dataSourceRef=myDataSource"/>
	    </camel:split>
	</camel:split>
    </camel:route>
</camel:camelContext>

And I know that will not work because I separated the csv line into several
messages when what I want is simple convert that line to an array or
something like that, but I just do not know how to do it.

A friend told me how to do it converting the csv lines into beans and
inserting them with JPA, but since I will be loading huge csv files very
often, I am concerned about unnecessary memory and processing use, so I
would like to do it without creating several objects.

Can you please help me?

Thank you in advance,
Bruno 

--
View this message in context: http://camel.465427.n5.nabble.com/Need-help-to-load-csv-into-database-tp5545754p5545754.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message