Skip to main content

JDBC Task

The JDBC task is used to execute or store information in SQL databases. It allows workflows to interact with SQL databases, enabling data retrieval and updates based on specified SQL queries.

A JDBC task evaluates SQL statements and parameters and can execute different SQL operations, such as SELECT or UPDATE. Based on the defined SQL statements and parameters, the appropriate database operations are carried out.

Task parameters

Configure these parameters for the JDBC task.

ParameterDescriptionRequired/ Optional
inputParameters. integrationNameThe relational database integration to use with the JDBC task. If your database isn't configured on your Conductor cluster, go to the Integrations tab and configure it under RDBMS > Relational Database.Required.
inputParameters. typeThe SQL statement type. Supported values:
  • SELECT—Used to retrieve data from a database.
  • UPDATE / DELETE—Used to modify or delete existing data from the database.
Required.
inputParameters. expectedOutputCountThe number of rows to be updated/deleted from the database.Required if the statement type is chosen as ‘UPDATE/DELETE’.
inputParameters. statementThe SQL statement to retrieve data from the SQL database.Required.
inputParameters. parametersThe query parameters to be bound by the SQL statement. It can be a string, number, boolean, or null.Required.

Caching parameters

You can cache the task outputs using the following parameters. Refer to Caching Task Outputs for a full guide.

ParameterDescriptionRequired/ Optional
cacheConfig.ttlInSecondThe time to live in seconds, which is the duration for the output to be cached.Required if using cacheConfig.
cacheConfig.keyThe cache key is a unique identifier for the cached output and must be constructed exclusively from the task’s input parameters.
It can be a string concatenation that contains the task’s input keys, such as ${uri}-${method} or re_${uri}_${method}.
Required if using cacheConfig.

Schema parameters

You can enforce input/output validation for the task using the following parameters. Refer to Schema Validation for a full guide.

ParameterDescriptionRequired/ Optional
taskDefinition.enforceSchemaWhether to enforce schema validation for task inputs/outputs. Set to true to enable validation.Optional.
taskDefinition.inputSchemaThe name and type of the input schema to be associated with the task.Required if enforceSchema is set to true.
taskDefinition.outputSchemaThe name and type of the output schema to be associated with the task.Required if enforceSchema is set to true.

Other generic parameters

Here are other parameters for configuring the task behavior.

ParameterDescriptionRequired/ Optional
optionalWhether the task is optional. The default is false.

If set to true, the workflow continues to the next task even if this task is in progress or fails.
Optional.

Task configuration

This is the task configuration for a JDBC task.

{
"name": "jdbc",
"taskReferenceName": "jdbc_ref",
"inputParameters": {
"integrationName": "db-name",
"statement": "SELECT * FROM tableName WHERE id=?",
"parameters": ["${workflow.input.text}"],
"type": "SELECT"
}
}

Task output

The JDBC task will return the following parameters.

ParameterDescription
resultAn array of data queried from the database.

Adding a JDBC task in UI

To add a JDBC task:

  1. In your workflow, select the (+) icon and add a JDBC task.
  2. In Integration name, select the integration to be used.
  3. Choose the Statement type as SELECT or UPDATE/DELETE.
  4. Enter the Expected update count if the statement type is UPDATE/DELETE.
  5. Enter the Statement to be queried and the Query parameters.

Adding JDBC task

Examples

Here are some examples for using the JDBC task.

Retrieving data

In this example, the JDBC task is used to retrieve customer data from a database called myApp. The Select SQL statement type is used, along with the statement “SELECT * FROM customers”.

{
"name": "jdbc",
"taskReferenceName": "jdbc_ref",
"inputParameters": {
"integrationName": "myApp",
"statement": "SELECT * FROM customers",
"parameters": [],
"type": "SELECT"
},
"type": "JDBC"
}

Upon completion, the JDBC task will return the customer data in the result array.

{
"result": [
{
"name": "c4ca4238a0",
"id": 1,
"value": 0.8000853
},
{
"name": "c81e728d9d",
"id": 2,
"value": 0.5992253
},
{
"name": "eccbc87e4b",
"id": 3,
"value": 0.50512415
},
{
"name": "a87ff679a2",
"id": 4,
"value": 0.3834899
},
{
"name": "e4da3b7fbb",
"id": 5,
"value": 0.38542742
},
{
"name": "1679091c5a",
"id": 6,
"value": 0.63664705
},
{
"name": "8f14e45fce",
"id": 7,
"value": 0.6443781
},
{
"name": "c9f0f895fb",
"id": 8,
"value": 0.81284344
},
{
"name": "45c48cce2e",
"id": 9,
"value": 0.31227082
},
{
"name": "d3d9446802",
"id": 10,
"value": 0.6765504
}
]
}