# Database Activity

Within **Process Designer**, ONEWEB provides a **Database Activity node** that enables processes (Microflows) to interact with databases in a **structured and governed manner**.

The Database Activity allows a process to perform database operations such as:

* `SELECT` – retrieve data
* `INSERT` – create new records
* `UPDATE` – modify existing records
* `DELETE` – remove records

By using Database Activity, data access is kept **inside the process layer**, ensuring that business logic, validation, and governance rules are consistently applied.

***

### Purpose of Database Activity

Database Activity is used when:

* Data access must follow defined process logic
* Multiple steps or rules must be executed before or after database operations
* UI components should not access databases directly
* Transaction control and consistency are required

This approach supports clean separation between **UI**, **process logic**, and **data storage**.

***

### Configure Database Activity in a Process

#### Step 1: Define Process Parameters

Before configuring the Database Activity, create the required **Input and Output Process Parameters**.

These parameters are used to:

* Pass data into the Database Activity
* Receive results from database operations

<figure><img src="https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2F85wg64EzBZSiLez9dydN%2Fimage.png?alt=media&#x26;token=bf6a6daf-cace-49b8-9446-b04199263918" alt=""><figcaption></figcaption></figure>

***

#### Step 2: Add Database Activity Node

1. Open **Process Designer**
2. Drag and drop the **Database node** into the process flow
3. Place the node between the **Start** and **End** nodes
4. Connect the Database node appropriately

This example demonstrates a simple process containing only a database activity.

<figure><img src="https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FAgK6qvhPyszx3NYgM7oC%2Fimage.png?alt=media&#x26;token=68223cba-f7bf-42b4-876d-8d5785f58bbc" alt=""><figcaption></figcaption></figure>

***

#### Step 3: Configure Database Activity

Double‑click the **Database node** to open its configuration panel.

***

#### **Business Object Configuration**

1. Open the **BusinessObject** tab
2. Select the appropriate **Business Object** for:
   * Input mapping
   * Output mapping

This defines how data flows between the process and the database.

<figure><img src="https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FzcpA09R5Njy8OBHGyXCM%2Fimage.png?alt=media&#x26;token=c1e365c2-bb12-4c3b-9cda-e18c87d07681" alt=""><figcaption></figcaption></figure>

***

#### **Database Connection Configuration**

Open the **Database Parameter** tab to configure the connection.

ONEWEB supports two connection types:

**JNDI Connection**

Used for managed, server‑side datasource connections.

<figure><img src="https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FF2F10CEtw12p50uDGNkl%2Fimage.png?alt=media&#x26;token=345360d3-3813-43f9-9885-f200e1346265" alt=""><figcaption></figcaption></figure>

**JDBC Connection**

Used when a direct JDBC configuration is required.

<figure><img src="https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FLOGmEw1FU5TDWRenEkeK%2Fimage.png?alt=media&#x26;token=8250e51b-b63a-4eaa-be3b-a6aee0d9307e" alt=""><figcaption></figcaption></figure>

***

#### Step 4: Map Activity Parameters

Map the **Process Activity Parameters** to the **Database Parameters** for both input and output.

This mapping ensures:

* Correct data is passed into the query
* Query results are returned to the process correctly

<figure><img src="https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FNYFz96RLUG8yBUkKUdOy%2Fimage.png?alt=media&#x26;token=07c7e3bb-82fd-4b81-bdeb-8b9a56c4594d" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FMx6bdp3qQrR9OA1qXrH9%2Fimage.png?alt=media&#x26;token=f7e23f8b-7e6c-4c3f-8582-713a01bc99a6" alt=""><figcaption></figcaption></figure>

***

#### Step 5: Save the Process

After completing configuration, save the process flow.

***

### ▶Test Database Activity Using Simulator

ONEWEB provides a **Simulator Utility** to test process execution.

#### Run the Simulation

1. Open the **Simulator**
2. Enter input values (use double quotes for string values)
3. Click **Start** to execute the process

<figure><img src="https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FNQIthU3zjCYEao8GI2UE%2Fimage.png?alt=media&#x26;token=a18826f8-47cd-4115-bb62-c75c42841111" alt=""><figcaption></figcaption></figure>

***

#### View Query Results

The Database node executes the configured query and returns the result, which is displayed in the simulator output.

<figure><img src="https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FcnBTt9WBqjCouLDZJWPs%2Fimage.png?alt=media&#x26;token=a157f42a-6054-4a71-abf2-bab16dc9df5c" alt=""><figcaption></figcaption></figure>

***

### Summary

The **Database Activity** node enables processes in ONEWEB to access and manipulate database data in a structured and governed way.

Key benefits include:

* Centralized data access through processes
* Support for all standard database operations
* Clear separation between UI, process logic, and data
* Improved data integrity and governance
* Easy testing and validation using the simulator

Database Activity is a core building block for **Process‑driven Data Access** and plays an essential role in ONEWEB’s **Data & Content Management** strategy.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.onewebstack.com/oneweb-platform-th/building-apps/data-and-content-management/database-access-management/data-access-from-process/database-activity.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
