Skip to content

Commit 94ed72c

Browse files
committed
worked on review comments iteration1
1 parent 0b0674f commit 94ed72c

1 file changed

Lines changed: 29 additions & 30 deletions

File tree

content/en/docs/howto/integration/use-the-external-database-connector.md

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ This how-to teaches you how to do the following:
2424
* Connect your Mendix App with an external Database.
2525
* Create and execute different SQL Queries.
2626

27-
Let's try to build below use case using External Database Connector in Mendix App:
28-
29-
Connect to an external database(MySQL) and retrieve list of Requested Products from database, also as a user you can Request for a Product using Mendix App.
27+
Let's use External Database Connector in Mendix App, to connect, retreive and insert data.
3028

3129
## 2 Prerequisites
3230

@@ -41,9 +39,9 @@ if additional connection properties are required to connect, you can alternative
4139

4240
## Steps to follow:
4341

44-
### 1.Establish connection between External database and Mendix app
42+
### 1. Establish connection between external database and Mendix app
4543

46-
1. Create new document of type **External Database document.”**(File -> New Document -> External Database Connection or Rightclick on Module -> Add other -> External Database Connection)
44+
1. Create new document of type **'External Database document'**(File -> New Document -> External Database Connection or Rightclick on Module -> Add other -> External Database Connection)
4745

4846
2. Select Database and add Connection details to connect to Database
4947

@@ -53,24 +51,26 @@ if additional connection properties are required to connect, you can alternative
5351

5452
{{< figure src="/attachments/howto/integration/use-the-external-database-connector/2.png" >}}
5553

56-
Hurray Connection between your External Database and Mendix app is established successfully.
54+
Hurray Connection between your external database and Mendix app is established successfully.
55+
56+
Click on **Save** to save connection details, these details are stored in 3 constants.
5757

58-
Click on “Save” to save connection details in 3 constants
58+
- \<Document Name\>_DBSource
59+
- \<Document Name\>_DBUsername
60+
- \<Document Name\>_DBPassword
5961

60-
- DBSource
61-
- DBUsername
62-
- DBPassword
62+
For example: *Database*_DBsource.
6363

64-
### 2 Explore Tables and Views of a connected Database:
64+
### 2. Explore Tables and Views of a connected Database:
6565

66-
Once connection is successful and saved , you can explore and search different **Tables & Views** of external database in External Database Connection document.
66+
Once connection is successful and saved, you can explore and search **Tables & Views** of external database in External Database Connection document.
6767

6868
{{< figure src="/attachments/howto/integration/use-the-external-database-connector/3.png" >}}
6969

70-
### 3 Create and Validate SQL Queries with Parameters:
70+
### 3. Create and Validate SQL Queries with Parameters:
7171

72-
a. Create new query by entering **SQL Query** in query editor box.
73-
b. Add **Parameters** if you want to use constants or variables in your query during runtime(use curly braces to include parameters in query).
72+
a. Create new query by entering **SQL Query** in SQL query editor box.
73+
b. Add **Parameters** if you want to use mendix constants or variables in your query during runtime(use curly braces to include parameters in query).
7474
c. Testvalue should be assigned to the parameter using **Add Parameter**.
7575
d. **Run Query** to validate query and see the response.
7676

@@ -81,36 +81,35 @@ SQL Query :
8181

8282
{{< figure src="/attachments/howto/integration/use-the-external-database-connector/4.png" >}}
8383

84-
### 4a Save Query & Create Enity:
84+
### 4a. Save Query & Create Enity:
8585

86-
a.For query which returns resultset for example Select query, use **Use Response** to create mapping.
87-
b.In **Response Structure** you can see Entity preview which will be created with mapping to the corresponding query response.
88-
c. Click on **Save Query & Create Enity** to create new Entity in domain model and Save Query with mapping.
86+
a. For query which returns a resultset, click **Use Response** to create mapping.
87+
b. In **Response Structure** you can see Entity preview.
88+
c. Click on **Save Query & Create Enity** to save query and a new Entity is created in the domain model using response structure.
8989

9090
{{< figure src="/attachments/howto/integration/use-the-external-database-connector/5.png" >}}
9191

92-
### 4b Save Query:
92+
### 4b. Save Query:
9393

94-
a.For queries which doesnot return resultset,
95-
Number of affected rows will be displayed as a Reponse.
94+
a. For DML queries, *Number of affected rows* will be displayed as a Reponse.
9695
For example:
9796
`INSERT INTO classicmodels.productlines(productLine, requestedProductRequirement)VALUES({productLine}, {requestedProductRequirement})`
98-
b.Click **Save Query**
97+
b. Click **Save Query**
9998
{{< figure src="/attachments/howto/integration/use-the-external-database-connector/6.png" >}}
10099

101100
**For all DML Queries, changes made to database in Mendix Design phase are automatically rolled back**
102101

103-
### 5 Use “Query External Database” activity:
102+
### 5. Use “Query External Database” activity:
104103

105-
a.Use "Query External Database" activity from toolbox in the microflow.
106-
b.Double click on activity and Select created External Database Connection document.
107-
c.All the queries created for the selected document, will appear in the dropdown, select the required one.
108-
d.Assign values to the parameters using "Expression editor".
109-
e.Output for the selected queries will be auto-populated based on the mapping of selected query.
104+
a. Use `Query External Database` activity from toolbox in the microflow.
105+
b. Double click on activity and select created External Database Connection document.
106+
c. All the queries created for the selected document will appear in the dropdown, select the required one.
107+
d. Assign values to the parameters using `Expression editor`.
108+
e. Output details for the selected query will be auto-populated.
110109

111110
{{< figure src="/attachments/howto/integration/use-the-external-database-connector/7.png" >}}
112111

113-
With these steps you are ready to use data in your Mendix App.
112+
With these steps you are ready to use data from external database in your Mendix App.
114113

115114
{{% alert color="warning" %}}
116115
It is your responsibility to apply the proper security, as this action can allow for SQL injection into your Mendix application. Among others things, do not use user-supplied or environment-supplied variables in your SQL statement; if possible, you should prefer them to be static.

0 commit comments

Comments
 (0)