Search code examples
datasourcemessagebrokeribm-integration-busextended-sql

IBM IIB 9 multiple data sources


I have message flow with compute node, which is calling some stored procedure from database. I set up data source field on this node for db1, same name exists in odbc.ini file. Now I want dynamically(without redeploying) change datasource to db2. For now I've found theese two solutions, but both of them ugly:

  1. Change datasource description in odbc.ini and call mqsireload.
  2. Declare user-defined properties for db name and schema, and call stored procedure like this:

    CALL SOME_PROC() IN DATABASE.{UDP_DBNAME}.{UDP_DBSCHEMA};

Then you can change this properties in runtime using broker API and flow will catch it immediately.

Are there any other options?


Solution

  • As per your requirements, you can do something like this:

    1. Define both DB1 and DB2 in your odbc.ini file
    2. Create two compute nodes that points to the same ESQL file, but one has the datasource configured with DB1 and the other with DB2
    3. Set a new compute node (before the previous two) that contains the logic to determine which one you want to use. Out1 is connected to ComputeNodeDB1 and Out2 is connected to ComputeNodeDB2.

    With this solution, DB can be dynamically determined during runtime!