You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by packiaraj <pa...@gmail.com> on 2014/08/21 13:29:46 UTC

Camel jdbc component not support sub query

Hi,

I am using below query  to get records

SELECT distinct TOP 1 MOBILE,FAX,ADDRESS_EMAIL, 
(case when((select count(*) from urole where r_id = 3 and U_ID = ID)>0) then
1 else 0 end as ROLE, 
case when((select count(*) from urole where r_id = 4 and u_id = ID) > 0)
then 1 else 0 end as ADMIN, 
case when((select count(*) from urole  where r_id = 2 and u_ID = ID)>0) then
1 else 0 end as VENDOR, 
case when((select count(*) from urole  where r_id =9 and u_id = ID)>0) then
1 else 0 end as NO_SURVEY_FLAG) from myuser 
where ADDRESS_EMAIL = :?emailID

When try to run this query using camel-jdbc component, am getting error
(com.microsoft.sqlserver.jdbc.SQLServerException:
com.microsoft.sqlserver.jdbc.SQLServerException: Invalid column name
'ADDRESS_EMAIL'.) in below line

int expectedCount = ps.getParameterMetaData().getParameterCount();

This happens only when trying to set emailid value dynamically.

Camel Version : 2.13.0

Route :

<route id="GetCustomerByEmail">
            <from id="GetCustomerByEmailAddress"
uri="direct:getCustomerByEmail" />
            <setHeader headerName="EmailId">
                 <simple>{{customer.emailid}}</simple>
             </setHeader>
            <setBody>
                 <constant>SELECT distinct TOP 1
MOBILE,FAX,ADDRESS_EMAIL,(case when((select count(*) from urole where r_id
= 3 and U_ID = ID)>0) then 1 else 0 end as ROLE, case when((select count(*)
from urole where r_id = 4 and u_id = ID) > 0) then 1 else 0 end as ADMIN,
case when((select count(*) from urole  where r_id = 2 and u_ID = ID)>0)
then 1 else 0 end as VENDOR, case when((select count(*) from urole  where
r_id =9 and u_id = ID)>0) then 1 else 0 end as NO_SURVEY_FLAG) from myuser
where ADDRESS_EMAIL = :?EmailId </constant>
              </setBody>
              <to
uri="jdbc:DataSource?useHeadersAsParameters=true&amp;useJDBC4ColumnNameAndLabelSemantics=true"/>
              <split>
                 <simple>${body}</simple>
                 <log message="*** Select all : ${body}"/>
               </split>
        </route>

Thanks
Packya.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-jdbc-component-not-support-sub-query-tp5755486.html
Sent from the Camel Development mailing list archive at Nabble.com.