DB2

Integration to provide connectivity to IBM DB2 using the python ibm_db2 library.

Database · DB2

Details

IDDB2
ProviderIBM
CategoryDatabase
From Version6.0.0
Docker Imagedemisto/ibm-db2:1.0.0.9067966
Supported ModulesAgentix XSIAM

README

Integration to provide connectivity to IBM DB2 using the python ibm_db2 library.
This integration was integrated and tested with version 0.1 of DB2

Configure DB2 in Cortex

Parameter Required
Database host True
Port False
Database Name False
Username True
Password True
Connection Arguments (ex: arg1=val1&arg2=val2) False
Use an SSL connection False
Use Persistent Connection False

Commands

You can execute these commands from the CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.

db2-query


Running a DB2 query command

Base Command

db2-query

Input

Argument Name Description Required
query The DB2 query to run. Required
limit The maximum number of results. Default is 50. Optional
skip The offset at which to start the result. Default is 0. Optional
bind_variables_name A comma separated list of names which will be replaced in query having ‘:<name>’. Optional
bind_variables_values A comma separated list of values corresponding to bind_variables_name or values in order of ‘?’ mark to be replaced in query. Optional

Context Output

There is no context output for this command.

Command Example

!db2-query query="CREATE TABLE publishers(publisher_id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(publisher_id))"

Human Readable Output

Configuration parameters

  • host — Database host (required)
  • port — Port
  • dbname — Database Name
  • credentials — Username (required)
  • connect_parameters — Connection Arguments (ex: arg1=val1&arg2=val2)
  • ssl_connect — Use an SSL connection
  • use_persistent — Use Persistent Connection

Commands (1)

  • db2-query

    Running a DB2 query command

## DB2 Integration
This integration helps in executing raw queries with the help of command `query` parameter.

## Default Port
If the `port` value is empty, a default port `50000` will be used.

## Connection Arguments
Specify arguments for the configuration of an instance name-value pairs, for example:

```
ATTR_CASE=CASE_NATURAL&SQL_ATTR_CURSOR_TYPE=SQL_CURSOR_FORWARD_ONLY
```

## Bind Variables 
There are two options to use to bind variables:

1. Use both bind variable names and values, for example:
```
"SELECT * from Table Where ID=:x" bind_variables_names="x" bind_variables_values="123"
```
2. Use only bind variable values, for example:
```
"INSERT into Table(ID, Name) VALUES (?, ?)" bind_variables_values= "123, Ben”
```

**Note:** Make sure only values are used as in `bind_variables_name` and `bind_variables_values`, not the table column name.