You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2015/03/16 23:00:57 UTC

svn commit: r1667141 - /tomee/site/trunk/content/datasource-config.mdtext

Author: rmannibucau
Date: Mon Mar 16 22:00:56 2015
New Revision: 1667141

URL: http://svn.apache.org/r1667141
Log:
few words on XaDataSource configuration

Modified:
    tomee/site/trunk/content/datasource-config.mdtext

Modified: tomee/site/trunk/content/datasource-config.mdtext
URL: http://svn.apache.org/viewvc/tomee/site/trunk/content/datasource-config.mdtext?rev=1667141&r1=1667140&r2=1667141&view=diff
==============================================================================
--- tomee/site/trunk/content/datasource-config.mdtext (original)
+++ tomee/site/trunk/content/datasource-config.mdtext Mon Mar 16 22:00:56 2015
@@ -462,3 +462,60 @@ destroyed and removed from the pool
 NOTE - for a true value to have any effect, the
 timeBetweenEvictionRunsMillis property must be a positive
 number and the ValidationQuery parameter must be set.
+
+# XADataSource
+
+There are several ways to configure a XADataSource. Depending the underlying datasource (Oracle, MySQL one or the other
+solution can be more adapted.
+
+This part deals with `JtaManaged` XaDataSource since a not managed XaDataSource can be defined as a standard
+resource using `class-name`.
+
+## Single definition
+
+First solution is to define as `JdbcDriver` an XADataSource:
+
+    <Resource id="myXaDs" type="DataSource">
+        JdbcDriver = org.foo.MyXaDataSource
+
+        myXaProperty = value
+
+        myPoolProperty = 10
+    </Resource>
+
+This solution merges properties for the XaDataSource and the pool (tomcat-jdbc for TomEE, dbcp for OpenEJB by default
+but still configurable with DataSourceCreator).
+
+Note: in this case for Oracle for instance you'll define UserName for the pool and User for the datasource which
+can look weird if you don't know properties are used for 2 instances (pool and datasource).
+
+Note: this solution uses the same logic than @DataSourceDefinition factory mecanism.
+
+## Two resource definition
+
+An alternative is to define a resource for the XaDataSource:
+
+    <Resource id="myXa" class-name="org.foo.MyXaDataSource">
+        myXaProperty = value
+    </Resource>
+
+And then wrap it in the pool:
+
+    <Resource id="myXaDs" type="DataSource">
+        DataSourceCreator = [dbcp|dbcp-alternative]
+        myPoolProperty = 10
+    </Resource>
+
+Note: `dbcp` is more adapted than `dbcp-alternative` in most of the case because it is reusing direct dbcp JTA management.
+
+## Known issues
+
+For TomEE 1.7.0/1.7.1 you can need to add the property:
+
+     openejb.datasource.pool = true
+
+in resource properties to ensure the resource is pooled.
+
+
+
+