Welcome to JavaRanch.
What does "nearly 3 connections" mean? 2? 3? Why does the code get more than one connection per datasource inside of a single transaction?
Is it required to close all connections before committing?
If a connection is closed, all pending transactions are rolled back - probably not what you want.
It sounds as if the code is trying to use an XA transaction with a non-XA capable datasource. Can the code get an XA-capable connection for DB2 as well?