I've tried this, see this question, which I had when trying to introduce integration tests using Derby for a legacy database that used DB2. How well using Java DB in place of DB2 will depend on how much DB2-specific SQL and DDL you need to support.
If you want a version of DB2 you can install on a developer machine, you could try IBM DB2 Express-C, it's a no-charge version of DB2 you can use locally.