1 Reply Latest reply on Dec 8, 2016 10:53 PM by sonyjop

    How to access Teiid VDB from a camel route in JBoss Fuse

    sonyjop

      Do any one have a suggestion as to how to access the teiid VDB using jdbc driver from a karaf based container.

       

      In my case, I try to access it as a below from a blueprint file. While I install the bundle, an exception is thrown as "

      org.osgi.service.blueprint.container.ComponentDefinitionException: Error setting property: PropertyDescriptor <name: driverClassName, getter: null, setter: [class org.springframework.jdbc.datasource.DriverManagerDataSource.setDriverClassName(class java.lang.String)]

        at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:963)[13:org.apache.aries.blueprint.core:1.6.1]

        at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:929)[13:org.apache.aries.blueprint.core:1.6.1]

        at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:910)[13:org.apache.aries.blueprint.core:1.6.1]

        at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:844)[13:org.apache.aries.blueprint.core:1.6.1]

        at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:811)[13:org.apache.aries.blueprint.core:1.6.1]

        at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[13:org.apache.aries.blueprint.core:1.6.1]

        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_31]

      "

       

      <bean id="ds"

        class="org.springframework.jdbc.datasource.DriverManagerDataSource">

        <property name="driverClassName" value="org.teiid.jdbc.TeiidDriver" />

        <property name="url"

        value="jdbc:teiid:${espxpertvdb_name}@mm://${espxpertvdb_host}:${espxpertvdb_port}" />

        <property name="username" value="${espxpertvdb_uname}" />

        <property name="password" value="${espxpertvdb_pwd}" />

        </bean>

        <bean id="jdbcTemplateREF" class="org.springframework.jdbc.core.JdbcTemplate">

        <property name="dataSource" ref="ds"></property>

        </bean>

        <bean id="calTornadoCrveDAO" class="com.bakerhughes.prod.esp.dao.CalculateTornadoCurveDAO">

        <property name="jdbcTemplate" ref="jdbcTemplateREF"></property>

        </bean>

        • 1. Re: How to access Teiid VDB from a camel route in JBoss Fuse
          sonyjop

          This problem is solved.

           

          The issue faced was that of org.teiid.jdbc.TeiidDriver is based on a singleton factory pattern so it could not be instantiated by org.springframework.jdbc.datasource.DriverManagerDataSource.

           

          So I have used org.springframework.jdbc.datasource.SimpleDriverDataSource as below:

           

              <bean id="driver" class="org.teiid.jdbc.TeiidDriver" factory-method="getInstance"/>

           

           

              <bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">

              <property name="driver" ref="driver" />

            <property name="url" value="jdbc:teiid:MY_VDB_NAME@mm://localhost:31000"/>

            <property name="username" value="user" />

            <property name="password" value="user@123" />

             

          </bean>