2

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?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
CaptainFreedom
  • 117
  • 4
  • 11

2 Answers2

3

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!

Muhammad Faizan Uddin
  • 1,339
  • 12
  • 29
VincentS
  • 602
  • 1
  • 10
  • 24
0

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

Attila Repasi
  • 1,803
  • 10
  • 11