diff --git a/jboss/container/wildfly/launch/datasources/added/launch/datasource-common.sh b/jboss/container/wildfly/launch/datasources/added/launch/datasource-common.sh
index e97358d4..9bc36b8e 100644
--- a/jboss/container/wildfly/launch/datasources/added/launch/datasource-common.sh
+++ b/jboss/container/wildfly/launch/datasources/added/launch/datasource-common.sh
@@ -40,6 +40,8 @@ function clearDatasourceEnv() {
unset ${prefix}_TX_ISOLATION
unset ${prefix}_MIN_POOL_SIZE
unset ${prefix}_MAX_POOL_SIZE
+ unset ${prefix}_SAME_RM_OVERRIDE
+ unset ${prefix}_NO_TX_SEPARATE_POOL
unset ${prefix}_JTA
unset ${prefix}_NONXA
unset ${prefix}_DRIVER
@@ -405,7 +407,7 @@ function generate_external_datasource_xml() {
$tx_isolation"
fi
- if [ -n "$min_pool_size" ] || [ -n "$max_pool_size" ]; then
+ if [ -n "$min_pool_size" ] || [ -n "$max_pool_size" ] || [ -n "$same_rm_override" ] || [ -n "$no_tx_separate_pool" ]; then
if [ -n "$NON_XA_DATASOURCE" ] && [ "$NON_XA_DATASOURCE" = "true" ]; then
ds="$ds
"
@@ -422,6 +424,16 @@ function generate_external_datasource_xml() {
ds="$ds
$max_pool_size"
fi
+ # CLOUD-2903: For Oracle XA Datasources, this configuration is required
+ if [ -n "$same_rm_override" ]; then
+ ds="$ds
+ $same_rm_override"
+ fi
+ # RHPAM-2261
+ if [ -n "$no_tx_separate_pool" ]; then
+ ds="$ds
+ "
+ fi
if [ -n "$NON_XA_DATASOURCE" ] && [ "$NON_XA_DATASOURCE" = "true" ]; then
ds="$ds
"
@@ -527,6 +539,14 @@ function generate_external_datasource_cli() {
ds_tmp_key_values["max-pool-size"]=$max_pool_size
fi
+ if [ -n "${same_rm_override}"]; then
+ ds_tmp_key_values["same_rm_override"]=${same_rm_override}
+ fi
+
+ if [ -n "${no_tx_seperate_pool}" ]; then
+ ds_tmp_key_values["no-tx-separate-pool"]=${no_tx_seperate_pool}
+ fi
+
ds_tmp_key_values["user-name"]="${username}"
ds_tmp_key_values["password"]="${password}"
@@ -891,6 +911,12 @@ function inject_datasource() {
# max pool size environment variable name format: [NAME]_[DATABASE_TYPE]_MAX_POOL_SIZE
max_pool_size=$(find_env "${prefix}_MAX_POOL_SIZE")
+ # is same rm override environment variable name format: [PREFIX]_SAME_RM_OVERRIDE
+ same_rm_override=$(find_env "${prefix}_SAME_RM_OVERRIDE")
+
+ # no_tx_separate_pool environment variable name format: [PREFIX]_NO_TX_SEPARATE_POOL
+ no_tx_separate_pool=$(find_env "${prefix}_NO_TX_SEPARATE_POOL")
+
# jta environment variable name format: [NAME]_[DATABASE_TYPE]_JTA
jta=$(find_env "${prefix}_JTA" true)
diff --git a/jboss/container/wildfly/launch/datasources/module.yaml b/jboss/container/wildfly/launch/datasources/module.yaml
index 6134f2d3..643a0c01 100644
--- a/jboss/container/wildfly/launch/datasources/module.yaml
+++ b/jboss/container/wildfly/launch/datasources/module.yaml
@@ -54,9 +54,13 @@ envs:
- name: "{PREFIX}_NONXA"
description: "Defines the datasource as a non-XA datasource. Defaults to false."
example: "true"
+ - name: "{PREFIX}_NO_TX_SEPARATE_POOL"
+ description: "Whether to create separate sub-pools for each context. This is required for Oracle datasources, which do not allow XA connections to be used both inside and outside of a JTA transaction."
- name: "{PREFIX}_PASSWORD"
description: "Defines the password for the datasource."
example: "password"
+ - name: "{PREFIX}_SAME_RM_OVERRIDE"
+ description: "Whether the javax.transaction.xa.XAResource.isSameRM(XAResource) class returns true or false."
- name: "{PREFIX}_TX_ISOLATION"
description: "Defines the java.sql.Connection transaction isolation level for the datasource."
example: "TRANSACTION_READ_UNCOMMITTED"
diff --git a/jboss/container/wildfly/launch/datasources/test/datasource/configure.bats b/jboss/container/wildfly/launch/datasources/test/datasource/configure.bats
index 85a21c84..adde17f8 100644
--- a/jboss/container/wildfly/launch/datasources/test/datasource/configure.bats
+++ b/jboss/container/wildfly/launch/datasources/test/datasource/configure.bats
@@ -267,6 +267,8 @@ load common
TEST_CONNECTION_CHECKER="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"
TEST_EXCEPTION_SORTER="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"
TEST_BACKGROUND_VALIDATION="false"
+ TEST_SAME_RM_OVERRIDE=false
+ TEST_NO_TX_SEPARATE_POOL=true
run inject_datasources
@@ -302,6 +304,9 @@ load common
TEST_XA_CONNECTION_PROPERTY_PortNumber="50000"
TEST_XA_CONNECTION_PROPERTY_DatabaseName="ibmdb2db"
+ TEST_SAME_RM_OVERRIDE=false
+ TEST_NO_TX_SEPARATE_POOL=true
+
run inject_datasources
[ "$status" -eq 0 ]
diff --git a/jboss/container/wildfly/launch/datasources/test/datasource/expectations/prefix_ibmdb2_xa.xml b/jboss/container/wildfly/launch/datasources/test/datasource/expectations/prefix_ibmdb2_xa.xml
index 72060ecc..52d51630 100644
--- a/jboss/container/wildfly/launch/datasources/test/datasource/expectations/prefix_ibmdb2_xa.xml
+++ b/jboss/container/wildfly/launch/datasources/test/datasource/expectations/prefix_ibmdb2_xa.xml
@@ -5,6 +5,10 @@
50000
localhost
ibmdb2
+
+ false
+
+
kermit
thefrog
diff --git a/jboss/container/wildfly/launch/datasources/test/datasource/expectations/prefix_oracle_xa.xml b/jboss/container/wildfly/launch/datasources/test/datasource/expectations/prefix_oracle_xa.xml
index 037069f6..4cbfb71f 100644
--- a/jboss/container/wildfly/launch/datasources/test/datasource/expectations/prefix_oracle_xa.xml
+++ b/jboss/container/wildfly/launch/datasources/test/datasource/expectations/prefix_oracle_xa.xml
@@ -3,6 +3,10 @@
jdbc:oracle:thin:@oracleHostName:1521:orcl
oracle
+
+ false
+
+
kermit
thefrog
diff --git a/test-common/xml_utils.bash b/test-common/xml_utils.bash
index 62ab9ab1..3230fee1 100644
--- a/test-common/xml_utils.bash
+++ b/test-common/xml_utils.bash
@@ -3,7 +3,7 @@ function assert_xml() {
local xpath=$2
local expected=$3
local xml=$(xmllint --xpath "$xpath" $file)
- diff <(echo $xml | xmllint --format -) <(xmllint --format $expected)
+ diff -ur <(echo $xml | xmllint --format -) <(xmllint --format $expected)
}
function assert_xml_value() {