1 out of 3 Transactions in DB2 fail with SQL 998, State 58005, error code 8, sub code 2 We have a few back-end applications using an XA switch module connected to a DB2 (10.5).
2 or 3 transactions will pass until this shows up:


I’ve found this document that talks about “Code 998, state 58005, reason code 9, subcode 2". 
Unfortunately, all they say is: 


  For reason code 9, subcode 02, ensure that the tp_mon_name configuration parameter contains the name of the dynamic library in the external product which has the ax_reg() function used for dynamic registration of transactions.



On the other hand, I found this document where, on the explanation of tm_database, they say "don't use tp_mon_name, if you are using XA switch module", which I am. But they don't explain tm_database.
I have two versions of the switch module, one with CONSTANT DYNAMICREGISTRATION "Y" and one with CONSTANT DYNAMICREGISTRATION "N".
The latter exists somewhere and will take me huge time to find.
Do you think it could be it?
Apparently, this was the switch module. 
The RM OPEN STRING definition included: rmopenstring=db=mydatabase,uid=uuuuuu,pwd=pppp,,axlib=somelib
Once the value for axlib was supplemented with an extention, .so, the error has gone away.