You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by alexey-s <al...@mail.ru> on 2012/04/08 22:19:55 UTC

OSGi JTA and NonXA DataSource

I use a camel running karaf. The data is stored in the database Oracle. From
the beginning I used OracleXADataSource. With increasing system performance
Oracle Server has often produce errors exceeding the number of connections.
For each transaction, JDBC driver creates a new connection to the Oracle
Server. Previously closed connections are not used in OracleXADataSource.
Oracle Server every 20 seconds, remove the connection closed. With a large
number of camel route overflow of allowable connections to Oracle Server.
I was looking for the option of using connection pooling. Found opens source
project Bitronix. Excellent functionality - LrcXADataSource. This
functionality is not running OSGi and Apache Aries. I reworked the
functional LrcXA classes to run on Apache Aries JTA.

Sample add XADataSource service:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
  xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  default-activation="lazy">

  <bean id="oracleDataSource" class="oracle.jdbc.pool.OracleDataSource">
    <cm:managed-properties
      persistent-id="mydb.jdbc.oracle"
      update-strategy="component-managed"
      update-method="update"/>
  </bean>

  <bean id="lrcXADataSource"
class="bitronix.tm.resource.jdbc.lrc.LrcXADataSource">
    <property name="dataSource" ref="oracleDataSource"/>
  </bean>

 <service id="xaDataSource" ref="lrcXADataSource"
interface="javax.sql.XADataSource">
    <service-properties>
      <entry key="osgi.jndi.service.name" value="jdbc/mydb"/>
    </service-properties>
  </service>
    
</blueprint>

attach source code 
http://camel.465427.n5.nabble.com/file/n5626400/osgi-lrcxa.tar.gz
osgi-lrcxa.tar.gz 

--
View this message in context: http://camel.465427.n5.nabble.com/OSGi-JTA-and-NonXA-DataSource-tp5626400p5626400.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: OSGi JTA and NonXA DataSource

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

Thanks for sharing this with us.

Do you mind to write a blog for it ? I'd be happy to add link in camel 
articles[1].

[1]https://cwiki.apache.org/CAMEL/articles.html


On Mon Apr  9 04:19:55 2012, alexey-s wrote:
> I use a camel running karaf. The data is stored in the database Oracle. From
> the beginning I used OracleXADataSource. With increasing system performance
> Oracle Server has often produce errors exceeding the number of connections.
> For each transaction, JDBC driver creates a new connection to the Oracle
> Server. Previously closed connections are not used in OracleXADataSource.
> Oracle Server every 20 seconds, remove the connection closed. With a large
> number of camel route overflow of allowable connections to Oracle Server.
> I was looking for the option of using connection pooling. Found opens source
> project Bitronix. Excellent functionality - LrcXADataSource. This
> functionality is not running OSGi and Apache Aries. I reworked the
> functional LrcXA classes to run on Apache Aries JTA.
>
> Sample add XADataSource service:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>    xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    default-activation="lazy">
>
>    <bean id="oracleDataSource" class="oracle.jdbc.pool.OracleDataSource">
>      <cm:managed-properties
>        persistent-id="mydb.jdbc.oracle"
>        update-strategy="component-managed"
>        update-method="update"/>
>    </bean>
>
>    <bean id="lrcXADataSource"
> class="bitronix.tm.resource.jdbc.lrc.LrcXADataSource">
>      <property name="dataSource" ref="oracleDataSource"/>
>    </bean>
>
>   <service id="xaDataSource" ref="lrcXADataSource"
> interface="javax.sql.XADataSource">
>      <service-properties>
>        <entry key="osgi.jndi.service.name" value="jdbc/mydb"/>
>      </service-properties>
>    </service>
>
> </blueprint>
>
> attach source code
> http://camel.465427.n5.nabble.com/file/n5626400/osgi-lrcxa.tar.gz
> osgi-lrcxa.tar.gz
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/OSGi-JTA-and-NonXA-DataSource-tp5626400p5626400.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--
Willem
----------------------------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang