Hi

Yes this one needs improved documentation. It is a good idea to check the unit 
test in Camel how we test the component itself.

You can configure the component in Spring XML as a standard Spring Bean where 
you can set the properties. I guess it has a flaw in the URI so you can set a 
ref to a datasource nice and easily from Spring DSL as well.

Something like this, its standard Spring stuff:

<bean id="sql" class="org.apache....SqlComponent"/>
   <property name="dataSource" ref="myDataSource"/>
</bean>





Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Reda [mailto:[EMAIL PROTECTED] 
Sent: 7. november 2008 19:42
To: camel-user@activemq.apache.org
Subject: Camel SQL Component & dataSource property


Hi

Reading http://activemq.apache.org/camel/sql-component.html I cannot
understand where I have to set the dataSource. I got

SEVERE: Failed: org.apache.camel.ResolveEndpointFailedException: Failed to
resolve endpoint: sql:select username as userid from mdl_user due to:
java.lang.IllegalArgumentException: Property 'dataSource' is required
org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint:
sql:select username as userid from mdl_user due to:
java.lang.IllegalArgumentException: Property 'dataSource' is required

with 

<route>
        <from uri="timer://pollTheDatabase?delay=10000" />
        <setProperty propertyName="dataSource">
                <constant>moodleDB</constant>
        </setProperty>
        <to uri="sql:select username as userid from mdl_user" />
</route>

and with

<route>
        <from uri="timer://pollTheDatabase?delay=10000" />
        <to uri="sql:select username as userid from
mdl_user?template.dataSource=moodleDB" />
</route>

where moodleDB is defined as

        <bean id="moodleDB"
                
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
                <property name="driverClassName" value="com.mysql.jdbc.Driver" 
/>
                <property name="url" value="jdbc:mysql://localhost:3306/moodle" 
/>
                <property name="username" value="moodle" />
                <property name="password" value="moodle" />
        </bean>


It would be nice to have an example for each camel component in "examples"
in the camel distribution...

Thanks in advance
Matteo


-- 
View this message in context: 
http://www.nabble.com/Camel-SQL-Component---dataSource-property-tp20386559s22882p20386559.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to