Hello list,

i'm currently using the following datasource in my project:

deploy/datasource.xml
---
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";>
<!-- *** Datasource: csv2xml ****************************************************** --> <bean id="dataSource-csv2xml" class="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"> <property name="url" value="jdbc:mysql://foo01.bar.com/csv2xml"/>
        <property name="user" value="myuser"/>
        <property name="password" value="sdhfhjsgdfhjgsdf"/>
    </bean>
<service interface="javax.sql.XADataSource" ref="dataSource-csv2xml">
        <service-properties>
            <entry key="osgi.jndi.service.name" value="jdbc/csv2xml"/>
        </service-properties>
    </service>
</blueprint>
---

This datasource is used by jndi in my osgi bundle.
In my understanding this datasource is not pooled.
This creates unnecessary connection creation overhead.

I was not able to find a good example for a pooled regular or XA-datasource - i.e. by using the C3P0- or DBCP pool. (http://www.mchange.com/projects/c3p0/, http://commons.apache.org/proper/commons-dbcp/)
Can you provide me a example?


What i tried:
(but i was not able to set i.e. the maxTotal option)
---
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";>
<!-- http://commons.apache.org/proper/commons-dbcp/configuration.html --> <bean id="dataSource-ecomx-dbcp" class="org.apache.commons.dbcp.BasicDataSource">
        <property name="username" value="ecomx"/>
        <property name="password" value="Ugogsdfsdf7thowoief9Aif1"/>
        <property name="url" value="jdbc:mysql://foobar.com/lallaa"/>
        <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
        <!--
        <property name="initialSize" value="0"/>
        <property name="maxIdle" value="20"/>
        <property name="minIdle" value="10"/>
        <property name="maxTotal" value="30"/>
        -->
    </bean>
<service interface="javax.sql.DataSource" ref="dataSource-ecomx-dbcp">
        <service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/lalala-dbcp"/>
        </service-properties>
    </service>
</blueprint>
---

Any hints?

Wy do i need XA-database interaction?
I would like to use this datasource for camel routes which interact with the following resources:
- i receive messages from a activemq message queue
- i store data to a mysql datasource
- i write a message to a queue
- i want to rollback all transaction is anything bad happens in the processing steps of the camel-route


Regards
Marc

Reply via email to