Bemærk
Adgang til denne side kræver godkendelse. Du kan prøve at logge på eller ændre mapper.
Adgang til denne side kræver godkendelse. Du kan prøve at ændre mapper.
Applies to: Azure Logic Apps (Consumption + Standard)
When your automated integration workflow needs to work with resources in your DB2 database, use a DB2 connector to perform operations on your database. For example, your workflow can list tables or rows, add rows, update rows, delete rows, run queries, and execute stored procedures. These actions can return data from your database for other actions in your workflow to use.
Azure Logic Apps provides the following DB2 connector versions:
- Managed connector: Available for Consumption and Standard workflows. For an on-premises DB2 server, this connector requires the on-premises data gateway.
- Built-in connector: Available only for Standard workflows. This connector runs in-process with the Azure Logic Apps runtime and connects directly to DB2 over TCP/IP without the on-premises data gateway.
Both versions communicate with remote DB2 servers across a TCP/IP network. You can use either version to access cloud databases such as IBM DB2 for Windows running in Azure virtualization.
Important
For mission-critical systems that use Standard workflows, use the built-in connector. The built-in connector avoids the extra gateway dependency and provides the performance and throughput benefits of running in-process with the Azure Logic Apps runtime. Use the managed connector when you need its specific operations or when you use a Consumption workflow.
This guide describes the operations and connection setup for both connector versions.
Supported platforms and versions
The DB2 connector supports the following IBM DB2 platforms and versions along with IBM DB2 compatible products that support Distributed Relational Database Architecture (DRDA) SQL Access Manager (SQLAM) versions 10 and 11:
| Platform | Version |
|---|---|
| IBM DB2 for z/OS | 12, 11.1, 10.1 |
| IBM DB2 for i | 7.4, 7.3, 7.2, 7.1 |
| IBM DB2 for LUW | 11.5, 11.1, 10.5 |
Connector technical reference
The DB2 connector has different versions, based on logic app type and host environment.
| Logic app | Environment | Connection version |
|---|---|---|
| Consumption | Multitenant Azure Logic Apps | Managed connector, which appears in the connector gallery under the Shared filter. This connector provides only actions, not triggers. For an on-premises DB2 server, the managed connector requires the on-premises data gateway. For more information, see the following documentation: - DB2 managed connector reference - Managed connectors in Azure Logic Apps |
| Standard | Workflow Service Plan, App Service Environment v3 (ASE v3 with Windows plans only), and Hybrid deployment on Azure Arc-enabled Kubernetes | Managed connector, which appears in the connector gallery under the Shared filter, and built-in connector, which appears in the connector gallery under the Built-in filter and is service provider-based. Both versions provide only actions, not triggers. For mission-critical workloads, use the built-in connector, which runs in-process with the Azure Logic Apps runtime and connects directly to DB2 over TCP/IP without the on-premises data gateway. For more information, see the following documentation: - DB2 managed connector reference - DB2 built-in connector reference - Built-in connectors in Azure Logic Apps |
Managed connector operations
The DB2 managed connector supports the following database operations, which map to the corresponding actions in the connector:
| Database operation | Connector action |
|---|---|
| List database tables | Get tables |
| Read one row using SELECT | Get row |
| Read all rows using SELECT | Get rows |
| Add one row using INSERT | Insert row |
| Edit one row using UPDATE | Update row |
| Remove one row using DELETE | Delete row |
For more information about the managed connector and these actions, see DB2 managed connector reference.
Built-in connector operations
The DB2 built-in connector supports the following actions:
| Action | Description |
|---|---|
| DB2 tables | Return tables in a DB2 schema. |
| Delete row | Delete one or more rows. |
| Execute a stored procedure | Run a stored procedure and return the output. |
| Execute non-query | Run a SQL statement that doesn't return a result set. |
| Execute query | Run a SQL query and return the result set. |
| Insert row | Insert a row into a DB2 table. |
| Update rows | Update one or more rows in a DB2 table. |
For more information about the built-in connector and these actions, see DB2 built-in connector reference.
Prerequisites
An Azure account and subscription. Get a free Azure account.
An IBM DB2 database, either cloud-based or on-premises.
The logic app resource and workflow from where you want to access your DB2 database.
The DB2 connector provides only actions. If you have an empty workflow, you must first add a trigger that works best for your scenario.
The examples in this guide use the Recurrence trigger.
For more information, see:
Connection requirements depend on the connector version:
Managed connector: To connect to an on-premises DB2 database, first install and set up the on-premises data gateway. The gateway isn't required when the DB2 server is publicly available or accessible in Azure.
Built-in connector: The on-premises data gateway isn't required. The Standard logic app hosting environment needs network access to the DB2 server and port.
Add a DB2 managed connector action
The following example uses the DB2 managed connector and shows how to add the Get tables action. To use the built-in connector with a Standard workflow, select Built-in in the connector gallery, and then select a DB2 built-in action, such as DB2 tables.
Note
The steps to add any other DB2 action are similar, except for the action's parameters and values that you provide.
In the Azure portal, open your logic app resource and workflow in the designer.
Follow the general steps to add the DB2 action named Get tables.
The connection information pane opens so you can provide details to connect your DB2 database.
Follow the steps to create a connection for a cloud-based database or on-premises database, then return here to continue.
After you successfully create the connection, the Get tables action information pane appears and shows that no other information is necessary:
Continue to Test your workflow and view output tables.
Set up a connection for the DB2 managed connector
Follow the steps based on whether you have a cloud or on-premises DB2 database. After you provide the necessary connection details, select Create new, and return to the previous steps.
Before you create a managed connector connection to an on-premises database, make sure that you install and set up the on-premises data gateway. This gateway requirement doesn't apply to the built-in connector.
| Property | Required | Description |
|---|---|---|
| Connect via on-premises gateway | No | Applies only to on-premises connections. |
| Connection Name | Yes | The name for your connection, for example, DB2-connection. |
| Server | Yes | The address or alias and port number for your DB2 server, for example, myDB2server.example.com:50000. Note: This value is a string that represents a TCP/IP address or alias, either in IPv4 or IPv6 format, followed by a colon and a TCP/IP port number. |
| Database | Yes | The name for your database. Note: This value is a string that represents a DRDA Relational Database Name (RDBNAM): - DB2 for z/OS accepts a 16-byte string where the database is known as an IBM DB2 for z/OS location. - DB2 for i accepts an 18-byte string where the database is known as an IBM DB2 for i relational database. - DB2 for LUW accepts an 8-byte string. |
| Username | Yes | Your user name for the database. Note: This value is a string whose length is based on the specific database: - DB2 for z/OS accepts an 8-byte string. - DB2 for i accepts a 10-byte string. - DB2 for Linux or UNIX accepts an 8-byte string. - DB2 for Windows accepts a 30-byte string. |
| Password | Yes | Your password for the database. |
For example:
Set up a connection for the DB2 built-in connector
For mission-critical Standard workflows, use the built-in connector. The built-in connector connects directly from the Azure Logic Apps runtime to your DB2 server over TCP/IP and doesn't use the on-premises data gateway. Ensure that the Standard logic app hosting environment has network access to the DB2 server and port.
In the workflow designer, select Built-in, select the DB2 action that you want, and create a connection. Provide the following information as applicable to your DB2 environment:
| Property | Description |
|---|---|
| Connection Name | The name for the connection. |
| Server Name | The DB2 server name. |
| Port Number | The database port number on the DB2 server. |
| Database | The database name on the DB2 server. |
| User Name | The user name for accessing the DB2 server. |
| Password | The password for the DB2 user name. |
| Package Collection | The package collection. Defaults to the user name if empty. |
| Default Schema | The default schema for schema calls, defaults to user name if empty. |
| Host CCSID | The host coded character set identifier (CCSID) for the DB2 database, defaults to 1208 if empty. |
| PC Code Page | The PC code page for the DB2 connection, defaults to 1208 if empty. |
| Additional Connection String Keywords | Optional connection string keywords, separated by semicolons. |
| Connection String | The DB2 connection string which if not empty then the rest of the properties are ignored. |
Test your workflow and view output tables
The following example shows output from the managed connector's Get tables action. You can test a workflow that uses a built-in connector action in the same way. To manually run your workflow, on the designer toolbar, from the Run list, select Run. After your workflow finishes, you can view the output from the run.
If the run details page doesn't open, follow these steps based on your logic app:
Consumption: On the logic app sidebar, under Development Tools, select Logic app designer.
Standard: On the workflow sidebar, select Run history.
In the Runs history list, select the latest workflow run, for example:
Consumption
Standard
On the run details page, review the status for each step in your workflow. To view the inputs and outputs for each step, select that step, for example:
To view the inputs in JSON, select Show raw inputs.
To view the outputs in JSON, select Show raw outputs.
The outputs include a list of tables, for example: