Skip to content

Updated External Database Connector documentation as per 11.1 release #9912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ Constants are an environment variable whose values can differ per environment, W

For free apps, make sure to add the default values to the constant in Studio Pro. For more information, see the [Deploying a Free App](https://docs.mendix.com/developerportal/deploy/mendix-cloud-deploy/deploying-an-app/#deploy-free-app) section below. {{% /alert %}}

{{% alert color="info" %}}
From Studio Pro 11.1, you can provide dynamic values to connection properties using connection parameters in the Query External Database activity. {{% /alert %}}

### Exploring Schemas of a Connected Database

When the connection is successful and saved, you can search the **Browse database** tab for Tables, Views, Procedures, and Functions.
Expand Down Expand Up @@ -165,12 +168,13 @@ Use the [Query External Database](/refguide/query-external-database/) activity t
2. Double-click the activity and in the **Database** field, click **Select** to choose the database you want to query.
3. Select the **Query** you want to include in the activity (that you saved while [querying the database](#query-database)).
4. Include any [parameters](#parameters).
5. In the **Output** field, choose if you want to **Use return value**.
5. Modify values for connection parameters, if you want to use a different set of connection details during runtime.
6. In the **Output** field, choose if you want to **Use return value**.

{{< figure src="/attachments/appstore/platform-supported-content/modules/external-database-connector/return-type.png" class="no-border" >}}

6. Click **OK**.
7. Configure the end event (such as displaying a list, if you are selecting data to appear in a list).
7. Click **OK**.
8. Configure the end event (such as displaying a list, if you are selecting data to appear in a list).

You can now use the microflow in your app. Below is an example of a configured microflow:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,27 @@ To learn how to use this activity in a microflow and configure other aspects of

Double-click the **Query External Database** activity to view its properties.

In the **Query** section are the following properties:
The **Query** section contains the following properties:

* **Database** – the name of the database you want to query
* **Query** – the saved SQL query from your configuration of the Database connector
* **Parameters** – the saved parameters from your configuration of the Database connector

The **Connection** section contains the following properties, which are used to provide dynamic connection parameter values:

* **DBSource** – Enter the JDBC URL you want to use for connection during runtime
* **DBUsername** – Enter the username you want to use for connection during runtime
* **DBPassword** – Enter the password you want to use for connection during runtime

If you are using SSL based authentication for Postgres, provide the value for

* **ClientCertificateIdentifier**

If you are using key-pair authentication for Snowflake, provide the value for:

* **PrivateKey**
* **Passphrase**

In the **Output** section are the following properties:

* **Return type** – the return type once the microflow is completed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ For example, the query below retrieves a list of RequestedProductRequirement whe
`Select requestedProductRequirement from productlines where productLine = {productLine}`
```

{{< figure src="http://attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/4.png" width="700" >}}
{{< figure src="/attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/4.png" width="700" >}}

### Typecast Parameter Data Type

You can typecast `String` into UUID, as shown below:

{{< figure src="http://attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/13.png" width="700" >}}
{{< figure src="/attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/13.png" width="700" >}}

## Save Query

Expand All @@ -62,11 +62,11 @@ You can typecast `String` into UUID, as shown below:

a. If **New Entity** is selected, you can view the entity in the **Response structure** tab. Click **Save Query & Create Entity** to save the query and the newly created entity in the domain model.

{{< figure src="http://attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/5.png" width="600" >}}
{{< figure src="/attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/5.png" width="600" >}}

b. If **Reuse Entity** is selected, all entities mapped to other queries of same document are listed in the drop-down list. Select the entity you want to reuse and click **Save Query**.

{{< figure src="http://attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/5a.png" width="600" >}}
{{< figure src="/attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/5a.png" width="600" >}}

### Save DML Query

Expand All @@ -76,7 +76,7 @@ You can typecast `String` into UUID, as shown below:

2. Click **Save Query**.

{{< figure src="http://attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/6.png" width="600" >}}
{{< figure src="/attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/6.png" width="600" >}}

{{% alert color="info" %}} For all DML Queries, changes made to database in the Mendix Design phase are automatically rolled back. {{% /alert %}}

Expand All @@ -102,7 +102,7 @@ Do the following:

b. If **Update Entity** is selected, you can see changes that will be made to the existing entity. Click **Update Entity** to save the query and the changes made to the entity in the domain model.

{{< figure src="http://attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/5b.png" width="600" >}}
{{< figure src="/attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/5b.png" width="600" >}}

## Call Stored Procedure

Expand All @@ -112,19 +112,19 @@ To call a stored procedure, do the following:

2. Enter the query to call a stored procedure. Add a schema name with the stored procedure name. For example, use the following syntax, where `latest_schema` is the schema name, and `InsertDataIntoTable1` is the stored procedure: `Call latest_schema.InsertDataIntoTable1({1},{2})`.

{{< figure src="http://attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/9.png" width="600" >}}
{{< figure src="/attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/9.png" width="600" >}}

3. Create **IN**, **OUT**, and **INOUT** parameters for all parameters present in the stored procedure. Make sure the **Name in DB** is the same as the name of parameter in the stored procedure.

{{< figure src="http://attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/10.png" width="600" >}}
{{< figure src="/attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/10.png" width="600" >}}

4. Click **Run Query**. This returns an entity with the number of affected rows and all INOUT and OUT parameters. If the stored procedure returns a **Result set**, an associated entity is created.

{{< figure src="http://attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/11.png" width="600" >}}
{{< figure src="/attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/11.png" width="600" >}}

5. Click **Use Response** > **Save Query & Create Entity** to save the query and the newly-created entities in the domain model.

{{< figure src="http://attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/12.png" width="600" >}}
{{< figure src="/attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/12.png" width="600" >}}

{{% alert color="info" %}}DML commands within a stored procedure are rolled back if they are not committed by a stored procedure, but DDL commands are not.{{% /alert %}}

Expand Down Expand Up @@ -160,11 +160,13 @@ For MSSQL, for **INOUT** and **OUT** parameters of type Decimal, test values (in

3. In the **Query** field, select the required query from the drop-down.

4. Assign values to the parameters using the **Expression editor**.
4. Assign values to the query parameters using the Expression editor.

5. Output details for the selected query auto-populate.
5. Assign values to the connection parameters that will be used to make a connection during runtime using the Expression editor.

6. Output details for the selected query auto-populate.

{{< figure src="http://attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/7.png" width="600" >}}
{{< figure src="/attachments/refguide/modeling/integration/use-platform-supported-content/use-the-external-database-connector/8.png" width="600" >}}

You are now ready to use data from an external database in your Mendix App.

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.