oracle datasource configuration with bitronix

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

oracle datasource configuration with bitronix

jetlag
I have an existing datasource setup where i'm trying to use certain oracle failover features and not sure how to configure these with the bitronix data source. i have read previous thread that there may be issues with oracle FAN etc but the question is a little more general - if i can verify the latest version of oracle XA datasource works with FAN, how would i configure it using A bitronix datasource?

thanks!

 <bean name="IHG:name=serviceContainer/dao/OracleDataSource" class="${redemption.datasource.driver}" destroy-method="close">
    <property name="URL" value="${redemption.datasource.url}"/>
    <property name="user" value="${redemption.datasource.username}"/>
    <property name="password" value="${redemption.datasource.password}"/>
    <property name="connectionCachingEnabled" value="${redemption.datasource.connectionCachingEnabled}"/>
    <property name="connectionCacheProperties">
      <props>
        <prop key="MinLimit">${redemption.datasource.pool.minLimit}</prop>
        <prop key="MaxLimit">${redemption.datasource.pool.maxLimit}</prop>
        <prop key="InitialLimit">${redemption.datasource.pool.initialLimit}</prop>
        <prop key="ConnectionWaitTimeout">${redemption.datasource.pool.connectionWaitTimeout}</prop>
        <prop key="ValidateConnection">${redemption.datasource.pool.validateConnection}</prop>
      </props>
    </property>
    <property name="fastConnectionFailoverEnabled" value="${redemption.datasource.oracle.fastConnectionFailoverEnabled}"/>
    <property name="ONSConfiguration" value="${redemption.datasource.oracle.ONSConfiguration}"/>
  </bean>
Reply | Threaded
Open this post in threaded view
|

Re: oracle datasource configuration with bitronix

Ludovic Orban
Administrator
I'm not familiar with Oracle FAN and while I can definitely see some potential issues there it might be worth trying it out to know for sure if it plays well with XA.

You need to make sure ${redemption.datasource.driver} resolves to a class which implements javax.sql.XADataSource then this is what your Spring datasource bean would look like:

<bean name="IHG:name=serviceContainer/dao/OracleDataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource" init-method="init" destroy-method="close">
  <property name="className" value="${redemption.datasource.driver}"/>
  <property name="uniqueName" value="IGH"/>
  <property name="minPoolSize" value="${redemption.datasource.pool.minLimit}"/>
  <property name="maxPoolSize" value="${redemption.datasource.pool.maxLimit}"/>
  <property name="driverProperties">
    <props>
      <prop key="URL">${redemption.datasource.url}</prop>
      <prop key="user">${redemption.datasource.username}</prop>
      <prop key="password">${redemption.datasource.password}</prop>
      <prop key="connectionCachingEnabled">${redemption.datasource.connectionCachingEnabled}</prop>
      <prop key="connectionCacheProperties.minLimit">${redemption.datasource.pool.minLimit}</prop>
      <prop key="connectionCacheProperties.maxLimit">${redemption.datasource.pool.maxLimit}</prop>
      <prop key="connectionCacheProperties.initialLimit">${redemption.datasource.pool.initialLimit}</prop>
      <prop key="connectionCacheProperties.connectionWaitTimeout">${redemption.datasource.pool.connectionWaitTimeout}</prop>
      <prop key="connectionCacheProperties.validateConnection">${redemption.datasource.pool.validateConnection}</prop>
      <prop key="fastConnectionFailoverEnabled">${redemption.datasource.oracle.fastConnectionFailoverEnabled}</prop>
      <prop key="ONSConfiguration">${redemption.datasource.oracle.ONSConfiguration}</prop>
    </props>
  </property>
</bean>

In case there is no javax.sql.XADataSource implementation you could still give it a try but you would need to get a java.sql.Driver implementation and wrap it in a bitronix.tm.resource.jdbc.lrc.LrcXADataSource. That would make the Spring bean somewhat more complex, wouldn't give you the full XA guarantees but may still be usable.


As I said earlier I don't know much about FAN so we may end up making something usable together but I definitely couldn't come up with something all by myself and this will probably need a few trial and error iterations trying different config settings and testing them.
Reply | Threaded
Open this post in threaded view
|

Re: oracle datasource configuration with bitronix

jetlag
i think The driver should still be the standard oracle XA driver. i will try that with the config info you gave below - thanks i really appreciate the clarification. i will post my results back today if i can.

thanks again!

Ludovic Orban wrote
I'm not familiar with Oracle FAN and while I can definitely see some potential issues there it might be worth trying it out to know for sure if it plays well with XA.

You need to make sure ${redemption.datasource.driver} resolves to a class which implements javax.sql.XADataSource then this is what your Spring datasource bean would look like:

<bean name="IHG:name=serviceContainer/dao/OracleDataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource" init-method="init" destroy-method="close">
  <property name="className" value="${redemption.datasource.driver}"/>
  <property name="uniqueName" value="IGH"/>
  <property name="minPoolSize" value="${redemption.datasource.pool.minLimit}"/>
  <property name="maxPoolSize" value="${redemption.datasource.pool.maxLimit}"/>
  <property name="driverProperties">
    <props>
      <prop key="URL">${redemption.datasource.url}</prop>
      <prop key="user">${redemption.datasource.username}</prop>
      <prop key="password">${redemption.datasource.password}</prop>
      <prop key="connectionCachingEnabled">${redemption.datasource.connectionCachingEnabled}</prop>
      <prop key="connectionCacheProperties.minLimit">${redemption.datasource.pool.minLimit}</prop>
      <prop key="connectionCacheProperties.maxLimit">${redemption.datasource.pool.maxLimit}</prop>
      <prop key="connectionCacheProperties.initialLimit">${redemption.datasource.pool.initialLimit}</prop>
      <prop key="connectionCacheProperties.connectionWaitTimeout">${redemption.datasource.pool.connectionWaitTimeout}</prop>
      <prop key="connectionCacheProperties.validateConnection">${redemption.datasource.pool.validateConnection}</prop>
      <prop key="fastConnectionFailoverEnabled">${redemption.datasource.oracle.fastConnectionFailoverEnabled}</prop>
      <prop key="ONSConfiguration">${redemption.datasource.oracle.ONSConfiguration}</prop>
    </props>
  </property>
</bean>

In case there is no javax.sql.XADataSource implementation you could still give it a try but you would need to get a java.sql.Driver implementation and wrap it in a bitronix.tm.resource.jdbc.lrc.LrcXADataSource. That would make the Spring bean somewhat more complex, wouldn't give you the full XA guarantees but may still be usable.


As I said earlier I don't know much about FAN so we may end up making something usable together but I definitely couldn't come up with something all by myself and this will probably need a few trial and error iterations trying different config settings and testing them.