Ok, I finally see what's happening here. For this testcase to work across multiple databases, two things have to be configured correctly for each database. They are:
1. A locking timeout has to be available and set for each database (or database server). For example, the default setting for Derby is derby.locks.waitTimeout=60 (i.e., 60 seconds), which is at the server level. For DB2, it can be set at a database level, but the default is LOCKTIMEOUT=-1, which disables it. Likewise for PostgreSQL the setting is at a server, not database, granularity, etc...
2. The sql-error-state-codes.xml file has to be properly populated with the appropriate lock and optimistic key values that correlate the database-dependent SQL codes and states to an optimistic lock.
I'll provide another patch tomorrow. Thanks