You have to configure it :)

 <bean class="org.apache.servicemix.components.jdnc.JdbcComponent">
    <property name="dataSource" ref="dataSource" />
 </bean>
 <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
   <property name="jndiName" value="java:comp/env/jdbc/servicemixDB"/>
 </bean>

Using JNDI is optional and you can configure it directly in the same file.

On 8/18/06, Sharon Yin <[EMAIL PROTECTED]> wrote:
Thanks , Guillaume.
I read the code of JdbcComponent.java, it's enough for me.
But I can't find anywhere that the " private DataSource dataSource;" being
initialized.
then it's been used like "conn = dataSource.getConnection();"


>From: "Guillaume Nodet" <[EMAIL PROTECTED]>
>Reply-To: [email protected]
>To: [email protected]
>Subject: Re: Should I extend JdbcComponent or invoke it directly?
>Date: Fri, 18 Aug 2006 09:49:34 +0200
>
>The JDBC component use JBI exchanges to perform requests on the DB.
>From your component, you need to create a JBI exchange and send it
>to
>this component.
>
>If the JDBC component does not fit your needs, you may want to
>extend it
>or write some custom code using direct JDBC calls.  I think it
>mainly
>depends on what you need to do on the database.
>
>
>On 8/18/06, Sharon Yin <[EMAIL PROTECTED]> wrote:
>>Help~
>>I've configure mysql into servicemix as a datasource, and when
>>startup
>>servicemix, I can see "INFO  - JDBCAdapterFactory - Database driver
>>recognized: [mysql-ab_jdbc_driver]."
>>is it mean that I 've deploy database into servicemix successfully?
>>what I 've done is :
>>1 copy this intto $servicemix/conf/jndi.xml
>>   <entry key="java:comp/env/jdbc/servicemixDB">
>>      <bean id="mysql-ds"
>>class="org.apache.commons.dbcp.BasicDataSource"
>>destroy-method="close">
>>       <property name="driverClassName"
>>value="com.mysql.jdbc.Driver"/>
>>       <property name="url"
>>value="jdbc:mysql://localhost:3306/AgoraRegistry?relaxAutoCommit=true"/>
>>       <property name="username" value="root"/>
>>       <property name="password" value="agora"/>
>>      </bean>
>>     </entry>
>>
>>2 copy this into one of your servicemix.xml
>>  <sm:jdbcAuditor container="#jbi" dataSource="#servicemixDB"
>>autoStart="false"/>
>>  <bean id="servicemixDB"
>>class="org.springframework.jndi.JndiObjectFactoryBean">
>>   <property name="jndiName"
>>value="java:comp/env/jdbc/servicemixDB"/>
>>  </bean>
>>
>>then I want to access mysql in my SE, could I invoke JdbcComponent
>>'s APIs
>>in the code level or I need to configure JdbcComponent as a SE in
>>servicemix.xml and access it via NMR?
>>or else I need to write a new class which is extend JdbcComponent
>>and
>>invoke it in my SE code?
>>Thanks,
>>Sharon.
>>
>>_________________________________________________________________
>>享用世界上最大的电子邮件系统― MSN Hotmail。
>>http://www.hotmail.com
>>
>>
>
>
>--
>Cheers,
>Guillaume Nodet

_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger:  http://messenger.msn.com/cn




--
Cheers,
Guillaume Nodet

Reply via email to