camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From somemightsay <euanbeg...@hotmail.com>
Subject SQL Query Properties file
Date Thu, 05 Aug 2010 14:07:29 GMT

Hi,

I currently have a program which pulls data from a database and outputs it
so a csv file.

The SQL Query used is pulled in from a properties file but I would like to
be able to define this in a bean within the Camel-Context.xml rather than
using pure Java in the java class.

Currently I have (Couldn't see a code tag, apologies if there is one):

public void configure() throws Exception {
                String query;
          Properties props = new Properties();      
                     try {
                     props.load(new FileInputStream("query.properties"));
                     query = props.getProperty("query");
         
                 CsvDataFormat csv = new CsvDataFormat();
                 
                 from("Schedule")
                 .startupOrder(1)
                 .setBody(constant(query))
                 .to("jdbc:exampledb")
                 .marshal(csv)
                 .to("TargetDir");
                      }


but is there a way to do this similar to what I am using to pull in the
database details from a properties file so that no addition code is needed
in the java class? ie.

<bean id="exampledb"
               
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
                <property name="driverClassName" value="${driverClassName}"
/>
                <property name="url" value="${url}" />
                <property name="username" value="${username}" />
                <property name="password" value="${password}" />
        </bean>

I have looked extensively on the camel website and google but could not find
an exact answer. I am using Camel 2.2.

Thanks. 
-- 
View this message in context: http://camel.465427.n5.nabble.com/SQL-Query-Properties-file-tp2265391p2265391.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message