Skip to content

Commit

Permalink
Merge pull request #644 from RizaFarheen/main
Browse files Browse the repository at this point in the history
jdbc update
  • Loading branch information
RizaFarheen authored Apr 5, 2024
2 parents 70a64fb + ee050c0 commit 818d03a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 42 deletions.
74 changes: 32 additions & 42 deletions docs/reference-docs/system-tasks/jdbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,34 @@ import TabItem from '@theme/TabItem';

# JDBC Task

A JDBC task is a system task used to execute or store information in SQL databases.
A JDBC task is a system task used to execute or store information in SQL databases.

## Definitions

```json
{
"name": "jdbc_test",
"description": "Edit or extend this sample workflow. Set the workflow name to get started",
"version": 1,
"tasks": [
{
"name": "jdbc_task",
"taskReferenceName": "jdbc_task",
"inputParameters": {
"connectionId": "",
"statement": "",
"parameters": [],
"type": "SELECT"
},
"type": "JDBC",
}
]
}
{
"name": "jdbc",
"taskReferenceName": "jdbc_ref",
"inputParameters": {
"integrationName": "jdbcintegrationtest_schema",
"statement": "SELECT * FROM tableName WHERE id=?",
"parameters": [
"${workflow.input.text}"
],
"type": "SELECT"
},
"type": "JDBC"
}
```

## Input Parameters

| Attributes | Description |
| ---------- | ----------- |
| connectionId | Provide the connection ID to establish a connection with the SQL database. <br/><br/>For example: **postgres://postgres@localhost/testdb** |
| statement | Provide the SQL statement to retrieve data from the SQL database. <br/><br/>An example statement would be **`SELECT * FROM tableName WHERE id=?`**, a query used to retrieve data from a table in a database. Replace **tableName** with the table name from which you want to retrieve data. |
| type | Indicates the SQL statement type. It can take 2 values, SELECT or UPDATE.<br/><br/><ul><li>**SELECT** - Used to retrieve data from a database.</li><li>**UPDATE** - Used to modify existing data from the database.<ul><li>**expectedUpdateCount** - If you have chosen ‘UPDATE’ as the statement type, provide the number of rows you need to update in the database.</li></ul></li></ul>|
| parameters | Provide the query parameters to be bound with the SQL statement. It can be a string, number, boolean, or null. |
| Integration name | Choose the required database integration. You can only choose the integration to which you have access here.<br/><br/>**Note**: If you haven’t configured your database on your Orkes console, navigate to the **Integrations** tab and configure the integration under “**RDBMS > Relational Database**”.|
| Statement type | Indicates the SQL statement type. It can take 2 values: SELECT or UPDATE.<br/><br/><ul><li>**SELECT** - Used to retrieve data from a database.</li><li>**UPDATE** - Used to modify existing data from the database.<ul><li>**Expected update count** - If you have chosen ‘UPDATE’ as the statement type, provide the number of rows you need to update in the database.</li></ul></li></ul>|
| Statement | Provide the SQL statement to retrieve data from the SQL database. <br/><br/>An example statement would be **`SELECT * FROM tableName WHERE id=?`**, a query used to retrieve data from a table in a database. Replace **tableName** with the table name from which you want to retrieve data. |
| Query parameters | Provide the query parameters to be bound with the SQL statement. It can be a string, number, boolean, or null. |
| cacheConfig | Enabling this option allows saving the cache output of the task. On enabling you can provide the following parameters:<ul><li>**TTL (in seconds)** - Provide the time to live in seconds.You can also pass this parameter as variables.</li><li>**Cache Key** - Provide the cache key, which is a string with parameter substitution based on the task input. You can also pass this parameter as variables.</li></ul>|

## Examples
Expand All @@ -54,7 +49,7 @@ A JDBC task is a system task used to execute or store information in SQL databas
<br/>

1. Add task type `JDBC`.
2. Provide the Connection ID.
2. Choose the integration name.
3. Choose the Statement Type.
4. Provide the SQL statement & Query parameters.

Expand All @@ -75,24 +70,19 @@ A JDBC task is a system task used to execute or store information in SQL databas
<TabItem value="JSON" label="JSON Example">

```json
{
"name": "jdbc_test",
"description": "Edit or extend this sample workflow. Set the workflow name to get started",
"version": 1,
"tasks": [
{
"name": "jdbc_task",
"taskReferenceName": "jdbc_task",
"inputParameters": {
"connectionId": "postgres://postgres@localhost/testdb",
"statement": "SELECT * FROM orkes",
"parameters": [],
"type": "SELECT"
},
"type": "JDBC",
}
]
}
{
"name": "jdbc",
"taskReferenceName": "jdbc_ref",
"inputParameters": {
"integrationName": "jdbcintegrationtest_schema",
"statement": "SELECT * FROM tableName WHERE id=?",
"parameters": [
"${workflow.input.text}"
],
"type": "SELECT"
},
"type": "JDBC"
}
```

</TabItem>
Expand Down
Binary file modified static/img/jdbc-worker-task.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 818d03a

Please sign in to comment.