Databases
IBM Db2

This is the implementation of the IBM Db2 data handler for MindsDB.

Db2 is a database product from IBM. It is a Relational Database Management System (RDBMS). Db2 is designed to store, analyze, and retrieve the data efficiently. Db2 product is extended with the support of Object-Oriented features and non-relational structures with XML.

Implementation

This handler is implemented using ibm_db/ibm_db_dbi, a Python library that allows you to use Python code to run SQL commands on the Db2 database.

The required arguments to establish a connection are as follows:

  • user is the username associated with the database.
  • password is the password required to authenticate your access to the database.
  • host is the hostname or IP address of the server.
  • port is the port through which TCP/IP connection is to be made.
  • database is the database name to be connected.
  • schema is required to get the tables.

Usage

In order to make use of this handler and connect to the Db2 database in MindsDB, the following syntax can be used:

CREATE DATABASE DB2_datasource
WITH
    engine = 'DB2',
    parameters = {
        "user": "db2admin",
        "password": "1234",
        "host": "127.0.0.1",
        "port": 25000,
        "schema_name": "db2admin",
        "database": "BOOKS"
    };

You can use this established connection to query your table as follows:

SELECT *
FROM DB2_datasource.AUTHORS;