CaptainFreedom
CaptainFreedom

Reputation: 127

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?

Upvotes: 2

Views: 4226

Answers (2)

VincentS
VincentS

Reputation: 592

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!

Upvotes: 3

Attila Repasi
Attila Repasi

Reputation: 1830

Another solution could be to use the PASSTHRU statement to run the database operations.

On that statement you can specify the datasource name so that it is subject to name substitution, which means that it can take the value of a user defined property, which in turn can be modified without stoping the flow.

https://www.ibm.com/support/knowledgecenter/en/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ak05890_.htm

Upvotes: 0

Related Questions