You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Abdeslam El Abbassi <ab...@thalesgroup.com> on 2007/03/21 17:35:28 UTC

using JdbcComponent

hi,
i try to access database by using the jdbc component.

my configuration :

  <bean class="org.apache.servicemix.components.jdbc.JdbcComponent">
     <property name="dataSource" ref="oracle-ds" />
  </bean>
<sm:activationSpec componentName="fileWriter" service="foo:fileWriter">
  <sm:component>
    <bean class="org.apache.servicemix.components.jdbc.JdbcComponent">
    </bean>
  </sm:component>
</sm:activationSpec>

How to pass the query (SQL) to the JdbcComponent ?

Regards,

Abdes





-- 
View this message in context: http://www.nabble.com/using-JdbcComponent-tf3442012s12049.html#a9598056
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: using JdbcComponent

Posted by Bruce Snyder <br...@gmail.com>.
On 3/22/07, Abdeslam El Abbassi <ab...@thalesgroup.com> wrote:
>
> Thanks,
>
> do you mean :
>
> <sm:activationSpec componentName="fileWriter" service="foo:fileWriter">
> <sm:component>
> <bean class="org.apache.servicemix.components.jdbc.JdbcComponent">
>      <sql>select p.id from product p where p.name='foo'</sql>
> </bean>
> </sm:component>
> </sm:activationSpec>
>
> when i try this , a have this error
>
> error: javax.jbi.messaging.MessagingException:
> java.lang.IllegalStateException: Expecting <sql></sql> node. Found: null

No, the SQL is in a message (similar to a JMS message) that is sent to
the component and the actual SQL wrapped in <sql> elements. It's not
just XML in the component configuration.

The configuration you show above is for a lightweight component.
LIghtweight components are easy to configure but they're not JBI
compliant. This component is started up inside ServiceMix and it is
ready to begin receiving messages. You will need to send a message to
the component. For an example of how all of this works, see the basic
example in the ServiceMix distribution. There's also documentation on
the basic example here:

http://incubator.apache.org/servicemix/basic.html

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache Geronimo - http://geronimo.apache.org/
Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Castor - http://castor.org/

Re: using JdbcComponent

Posted by Abdeslam El Abbassi <ab...@thalesgroup.com>.
Thanks,

do you mean :

<sm:activationSpec componentName="fileWriter" service="foo:fileWriter">
<sm:component>
<bean class="org.apache.servicemix.components.jdbc.JdbcComponent">
     <sql>select p.id from product p where p.name='foo'</sql>
</bean>
</sm:component>
</sm:activationSpec>

when i try this , a have this error

error: javax.jbi.messaging.MessagingException:
java.lang.IllegalStateException: Expecting <sql></sql> node. Found: null


Regards,
Abdes



bsnyder wrote:
> 
> On 3/21/07, Abdeslam El Abbassi <ab...@thalesgroup.com>
> wrote:
>>
>> hi,
>> i try to access database by using the jdbc component.
>>
>> my configuration :
>>
>>   <bean class="org.apache.servicemix.components.jdbc.JdbcComponent">
>>      <property name="dataSource" ref="oracle-ds" />
>>   </bean>
>> <sm:activationSpec componentName="fileWriter" service="foo:fileWriter">
>>   <sm:component>
>>     <bean class="org.apache.servicemix.components.jdbc.JdbcComponent">
>>     </bean>
>>   </sm:component>
>> </sm:activationSpec>
>>
>> How to pass the query (SQL) to the JdbcComponent ?
> 
> The SQL is a JBI message that is sent to the component wrapped in
> <sql> elements. Below is an example:
> 
> <sql>
> select p.id from product p where p.name='foo'
> </sql>
> 
> Bruce
> -- 
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
> 
> Apache Geronimo - http://geronimo.apache.org/
> Apache ActiveMQ - http://activemq.org/
> Apache ServiceMix - http://servicemix.org/
> Castor - http://castor.org/
> 
> 

-- 
View this message in context: http://www.nabble.com/using-JdbcComponent-tf3442012s12049.html#a9611228
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: using JdbcComponent

Posted by Bruce Snyder <br...@gmail.com>.
On 3/21/07, Abdeslam El Abbassi <ab...@thalesgroup.com> wrote:
>
> hi,
> i try to access database by using the jdbc component.
>
> my configuration :
>
>   <bean class="org.apache.servicemix.components.jdbc.JdbcComponent">
>      <property name="dataSource" ref="oracle-ds" />
>   </bean>
> <sm:activationSpec componentName="fileWriter" service="foo:fileWriter">
>   <sm:component>
>     <bean class="org.apache.servicemix.components.jdbc.JdbcComponent">
>     </bean>
>   </sm:component>
> </sm:activationSpec>
>
> How to pass the query (SQL) to the JdbcComponent ?

The SQL is a JBI message that is sent to the component wrapped in
<sql> elements. Below is an example:

<sql>
select p.id from product p where p.name='foo'
</sql>

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache Geronimo - http://geronimo.apache.org/
Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Castor - http://castor.org/