Multiple database configurations

To configure the queue manager so that updates to multiple databases can be included within global units of work, add an XAResourceManager stanza for each database.

If the databases are all managed by the same database manager, each stanza defines a separate database. Each stanza specifies the same SwitchFile, but the contents of the XAOpenString are different because it specifies the name of the database being updated. For example, the stanzas shown in Figure 1 configure the queue manager with the Db2 databases MQBankDB and MQFeeDB on UNIX and Linux systems.Important: You cannot have multiple stanzas pointing to the same database. This configuration does not work under any circumstances, and if you try this configuration it fails.

You will receive errors of the form when the MQ code makes its second xa_open call in any process in this environment, the database software fails the second xa_open with a -5 error, XAER_INVAL.

Figure 1. Sample XAResourceManager entries for multiple Db2 databases
XAResourceManager:
Name=DB2 MQBankDB
SwitchFile=db2swit
XAOpenString=MQBankDB

XAResourceManager:
Name=DB2 MQFeeDB
SwitchFile=db2swit
XAOpenString=MQFeeDB
If the databases to be updated are managed by different database managers, add an XAResourceManager stanza for each. In this case, each stanza specifies a different SwitchFile. For example, if MQFeeDB is managed by Oracle instead of Db2, use the following stanzas on UNIX and Linux systems:
Figure 2. Sample XAResourceManager entries for a Db2 and Oracle database
XAResourceManager:
Name=DB2 MQBankDB
SwitchFile=db2swit
XAOpenString=MQBankDB

XAResourceManager:
Name=Oracle MQFeeDB
SwitchFile=oraswit
XAOpenString=Oracle_XA+Acc=P/myuser/mypassword+SesTm=35+LogDir=/tmp/ora.log+DB=MQFeeDB

In principle, there is no limit to the number of database instances that can be configured with a single queue manager.

Note: For information on support for including Informix databases in multiple database updates within global units of work, check the product readme file. Parent topic: Scenario 1: Queue manager performs the coordination