You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by pointerness <ro...@nomura.com> on 2013/01/05 06:56:07 UTC

camel sql

Hi,
I am evaluating camel for our product. I am trying to use a camel route in
an existing web application.
We use spring-jdbc queryforlist to fetch data from DB. I thought camel's sql
component should be a straight fit. However I get either bad sql grammar or
class not found when I try to use the sql component. I had success when I
invoked the existing java bean via camel route, but sql for some reason
doesn't work.
The route I am using is <route><from uri="direct"a"><to
uri="sql:{{property.sqlquer}}"/><to uri="someJavaBean"/></route> In the
application the query is stored in a constant. I tried setting it as header
value. Even that did not work. I got a parsing exception, so decided to use
a property file. In both cases I was able to log the sql query and did not
see any error. Even though it's a complex query, it's static.
I then tried a very simple sql query which will return me a single column.
even that is failing.
Any ideas where I am going round. As this is a working porject, I am
confident the build path iscorrect. I  am not able to figure out why I am
getting a class not found for spring's rowmapper.





--
View this message in context: http://camel.465427.n5.nabble.com/camel-sql-tp5724935.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel sql

Posted by Christian Müller <ch...@gmail.com>.
camel-sql doesn't support changing the sql query by passing a special
header. Checkout the documentation [1].
If you have a need for this, feel free to log a JIRA [2].

[1] http://camel.apache.org/sql-component.html
[2] http://camel.apache.org/contributing.html

Best,
Christian

On Sat, Jan 5, 2013 at 10:52 AM, pointerness <rohit.venkatachalam@nomura.com
> wrote:

> Yep worked with 3.0. Thanks. Worked with sql query stored in a property
> file.
> not with header.
> I have put a map entry with key"sqlQuery". I use the map as the header
> argument to producerTemplate request body and header method. Am trying to
> use it in the route as <to uri="${header.sqlQuery}"/>
> Is this allowed?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/camel-sql-tp5724935p5724945.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--

Re: camel sql

Posted by Claus Ibsen <cl...@gmail.com>.
On Sat, Jan 5, 2013 at 10:52 AM, pointerness
<ro...@nomura.com> wrote:
> Yep worked with 3.0. Thanks. Worked with sql query stored in a property file.
> not with header.
> I have put a map entry with key"sqlQuery". I use the map as the header
> argument to producerTemplate request body and header method. Am trying to
> use it in the route as <to uri="${header.sqlQuery}"/>
> Is this allowed?

See this FAQ
http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html

>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-sql-tp5724935p5724945.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: camel sql

Posted by pointerness <ro...@nomura.com>.
Yep worked with 3.0. Thanks. Worked with sql query stored in a property file.
not with header.
I have put a map entry with key"sqlQuery". I use the map as the header
argument to producerTemplate request body and header method. Am trying to
use it in the route as <to uri="${header.sqlQuery}"/>
Is this allowed?



--
View this message in context: http://camel.465427.n5.nabble.com/camel-sql-tp5724935p5724945.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel sql

Posted by Claus Ibsen <cl...@gmail.com>.
On Sat, Jan 5, 2013 at 9:00 AM, pointerness
<ro...@nomura.com> wrote:
> Hi,
> I have tried using both dynamic and static queries. The exact error I now
> get is NoSuchMethodError. for
> org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(Jjava/sql/ResultSet;)Ljava/util/List
>
> From stack trace i can see query has been executed. Now the spring jdbc
> packages are already tghere in webinf/lib. As I said earlier we have been
> already using spring.
> We use spring 2.5 is that an issue?
>

It depends on the version of Camel you are using.

Camel 2.6.0 is the last release that supports Spring 2.5.x
http://camel.apache.org/camel-260-release.html

Any newer release you need Spring 3.0 or better.


>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-sql-tp5724935p5724943.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: camel sql

Posted by pointerness <ro...@nomura.com>.
Hi,
I have tried using both dynamic and static queries. The exact error I now 
get is NoSuchMethodError. for
org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(Jjava/sql/ResultSet;)Ljava/util/List

>From stack trace i can see query has been executed. Now the spring jdbc
packages are already tghere in webinf/lib. As I said earlier we have been
already using spring. 
We use spring 2.5 is that an issue?





--
View this message in context: http://camel.465427.n5.nabble.com/camel-sql-tp5724935p5724943.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel sql

Posted by Willem jiang <wi...@gmail.com>.
Hi,

What's you sql looks like?
Did you need to change it dynamically?
camel-sql support to use the query from message header with "CamelSqlQuery" which you can change the value dynamically.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Saturday, January 5, 2013 at 1:56 PM, pointerness wrote:

> Hi,
> I am evaluating camel for our product. I am trying to use a camel route in
> an existing web application.
> We use spring-jdbc queryforlist to fetch data from DB. I thought camel's sql
> component should be a straight fit. However I get either bad sql grammar or
> class not found when I try to use the sql component. I had success when I
> invoked the existing java bean via camel route, but sql for some reason
> doesn't work.
> The route I am using is <route><from uri="direct"a"><to
> uri="sql:{{property.sqlquer}}"/><to uri="someJavaBean"/></route> In the
> application the query is stored in a constant. I tried setting it as header
> value. Even that did not work. I got a parsing exception, so decided to use
> a property file. In both cases I was able to log the sql query and did not
> see any error. Even though it's a complex query, it's static.
> I then tried a very simple sql query which will return me a single column.
> even that is failing.
> Any ideas where I am going round. As this is a working porject, I am
> confident the build path iscorrect. I am not able to figure out why I am
> getting a class not found for spring's rowmapper.
>  
>  
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-sql-tp5724935.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: camel sql

Posted by Christian Müller <ch...@gmail.com>.
Please find my commets inline:

On Sat, Jan 5, 2013 at 6:56 AM, pointerness
<ro...@nomura.com>wrote:

> Hi,
> I am evaluating camel for our product. I am trying to use a camel route in
> an existing web application.
> We use spring-jdbc queryforlist to fetch data from DB. I thought camel's
> sql
> component should be a straight fit. However I get either bad sql grammar or
> class not found when I try to use the sql component.

Please share the query with us.
Please share the stack trace with us. Otherwise it's hard to tell what you
are doing wrong (You didn't mentioned the Camel version, the database
vendor, your runtime environment, the query, the class which is not found,
...). Please read http://camel.apache.org/support.html


> I had success when I
> invoked the existing java bean via camel route, but sql for some reason
> doesn't work.
> The route I am using is <route><from uri="direct"a"><to
> uri="sql:{{property.sqlquer}}"/><to uri="someJavaBean"/></route> In the
> application the query is stored in a constant.

Did you try to put the query direcly into this route definition?


> I tried setting it as header
> value. Even that did not work. I got a parsing exception,

Which header key do you use? Can you share the stack trace of this parsing
exception?


> so decided to use
> a property file. In both cases I was able to log the sql query and did not
> see any error. Even though it's a complex query, it's static.
> I then tried a very simple sql query which will return me a single column.
> even that is failing.
> Any ideas where I am going round. As this is a working porject, I am
> confident the build path iscorrect. I  am not able to figure out why I am
> getting a class not found for spring's rowmapper.
>
Which version of Spring do you use?


>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/camel-sql-tp5724935.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--