From dd712d50e048abca9d22af1e3d706f67b5a15027 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 09:32:46 +0000 Subject: [PATCH] Fix: Port transaction details in the DB report mediator Co-Authored-By: Claude Sonnet 4.5 --- .../reference/mediators/db-report-mediator.md | 122 ++++++++++++++---- 1 file changed, 96 insertions(+), 26 deletions(-) diff --git a/en/docs/reference/mediators/db-report-mediator.md b/en/docs/reference/mediators/db-report-mediator.md index cdffd130d..84fd96870 100644 --- a/en/docs/reference/mediators/db-report-mediator.md +++ b/en/docs/reference/mediators/db-report-mediator.md @@ -11,7 +11,7 @@ The syntax of the DB Report mediator changes depending on whether you connect to - **Connection Pool** ```xml - + ( @@ -37,11 +37,14 @@ The syntax of the DB Report mediator changes depending on whether you connect to ``` - **Data source** - The syntax of the DBLookup mediator further differs based on whether the connection to the database is made using an external datasource or a Carbon datasource. Click on the relevant tab to view the required syntax. - + The syntax of the DB Report mediator further differs based on whether the connection to the database is made using an external datasource or a Carbon datasource. Click on the relevant tab to view the required syntax. + + !!! Note + You need to use a **Carbon Datasource** with the DBReport mediator for the Transaction Mediator to work correctly. Otherwise, operations like commit, rollback will not function as expected. + === "External Datasource" - ```xml - + ```xml + @@ -58,9 +61,9 @@ The syntax of the DB Report mediator changes depending on whether you connect to + ``` - === "Carbon Datasource" - ```xml - + === "Carbon Datasource" + ```xml + @@ -75,10 +78,7 @@ The syntax of the DB Report mediator changes depending on whether you connect to ## Configurations -The configuration of the DBQuery mediator changes depending on whether you connect to the database using a connection pool, or using a data -source. - -### Connection Pool configurations +### General configurations The parameters available to configure the DB Report mediator are as follows. @@ -125,6 +125,38 @@ Specifying the value as -1 allows unlimited transactions. Change the value accor

For detailed information about configuring Transaction mediators, see Transaction Mediator .

+ + + +The configuration of the DBReport mediator varies depending on whether you connect to the database using a connection pool or a datasource. Refer to the following sections accordingly. + +### Connection Pool configurations + +The parameters available to configure the DB Report mediator are as follows. + +!!! Info + When specifying the DB connection using a connection pool, other than specifying parameter values inline, you can also specify following parameter values of the connection information (i.e. Driver, URL, User and password) as registry entries. The advantage of specifying a parameter value as a registry entry is that the same connection information configurations can be used in different environments simply by changing the registry entry value. To do this, give the registry path within the `key` attribute as shown in the example below. + ```xml + + + + + + + + + + + ``` + + + + + + + + + @@ -230,14 +262,13 @@ Once you have defined the above parameters, enter the following properties: ### Datasource configurations -The configuration of the DBLookup mediator further differs based on whether the connection to the database is made using an external datasource or a Carbon datasource. +The configuration of the DB Report mediator further differs based on whether the connection to the database is made using an external datasource or a Carbon datasource. #### External Datasource The parameters available to configure the DB Report mediator as an external datasource are as follows. | Parameter Name | Description | |---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **Use Transaction** | This parameter specifies whether the database operation should be performed within a transaction or not. Click **Yes** or **No** as relevant. | | **Initial Context** | The initial context factory class. The corresponding ` Java ` environment property is ` java.naming.factory.initial ` . | | **Datasource Name** | The naming service provider URL . The corresponding ` Java ` environment property is ` java.naming.provider.url ` . | | **URL** | The JDBC URL of the database that data will be written to. | @@ -274,8 +305,34 @@ Once you have defined the above parameters, enter the following properties: | Parameter Name | Description | |---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **Use Transaction** | This parameter specifies whether the database operation should be performed within a transaction or not. Click **Yes** or **No** as relevant. | -| **Datasource** | This parameter is used to selected a specific Carbon datasource you want to use to make the connection. All the Carbon datasources which are currently available are included in the list. | +| **Datasource** | This parameter is used to select a specific Carbon datasource you want to use to make the connection. All the Carbon datasources which are currently available are included in the list. | + +If you plan to use transactions, you must configure the datasource with an `XADataSource` implementation and set `defaultAutoCommit` to false. This ensures that the Transaction Mediator can correctly manage commit and rollback operations. + +The following is a sample datasource configuration for a MySQL database: + +```xml + + inventoryDB + + jdbc/inventoryDB + + + + true + false + com.mysql.cj.jdbc.MysqlXADataSource + USERNAME + PASSWORD + + jdbc:mysql://localhost:3306/ + + + + +``` + +For more information on creating a datasource, see [Create a datasource]({{base_path}}/develop/creating-artifacts/data-services/creating-datasources). ### SQL statements @@ -388,11 +445,7 @@ Transaction Mediator configuration. - java:jdbc/XADerbyDS - org.jnp.interfaces.NamingContextFactory - localhost:1099 - EI - EI + jdbc/inventoryDB @@ -406,11 +459,7 @@ Transaction Mediator configuration. - java:jdbc/XADerbyDS1 - org.jnp.interfaces.NamingContextFactory - localhost:1099 - EI - EI + jdbc/inventoryDB @@ -454,3 +503,24 @@ Transaction Mediator configuration. ``` +=== "Data Source" + ```xml + + inventoryDB + + jdbc/inventoryDB + + + + true + false + com.mysql.cj.jdbc.MysqlXADataSource + USERNAME + PASSWORD + + jdbc:mysql://localhost:3306/ + + + + + ```
Parameter NameDescription
Driver The class name of the database driver.