Search code examples
db2ibm-cloudcognosdb2-woc

How to connect DB2 to Cognos Dynamic Dashboard Embedded on IBM Cloud


I have an IBM Cloud account with a DB2 (SMP Small), a Cognos Dynamic Dashboard Embedded services provisioned and a .php app bpund to the DB2 instance.

I managed to find some simple tutorials on how to create a session and a framework for the API using this: https://dde-us-south.analytics.ibm.com/daas/DashboardAPI.html

but I have 2 problems right up front. A) when I go to "Add source" the API has a "test source" but when I pull anything form that source into my dashboard that I am creating I am getting a "query service internal error has occured, please see the log for details" .... and B) what I really want to do is get this dashboard to connect to my DB2 ... and pull data from there for vizualizations?


Solution

  • For accessing JDBC sources, especially the table definition, you can follow what is documented. For accessing Db2 (on-prem or cloud) sources, use something similar to what is below. Adapt to your settings.

    {
        "xsd": "https://ibm.com/daas/module/1.0/module.xsd",
        "source": {
            "id": "StringID",
            "jdbc": {
                "jdbcUrl": "jdbcUrl: `jdbc:db2://DATABASE-HOST:50000/YOURDB`",
                "driverClassName": "com.ibm.db2.jcc.DB2Driver",
                "schema": "DEFAULTSCHEMA"
            },
            "user": "user_name",
            "password": "password"
        },
    

    I have written an app that uses Db2 data, but wraps it into CSV format because of additional filters. You can access the code in the GitHub repository here. There is a table definition in this JSON file for the dashboard. The overall scenario is described in this IBM Cloud solution tutorial.