How to achieve federation using JDBC?
CREATE WRAPPER, CREATE USER MAPPING and CREATE NICKNAME are all straight-forward SQL statements so you can execute them through JDBC the same as you would, say, a CREATE TABLE statement (same goes for DROP WRAPPER).

However, ATTACH, CATALOG, and UNCATALOG are entirely different beasts. They don't operate on a DB2 database, rather they affect a DB2 instance. I'm not aware of a method of executing these from JDBC (which is largely database-centric and doesn't have any special knowledge of structures "above" the database level). If all this needs to go together you're probably best off shoving it all in a batch file and executing that in a sub-process rather than trying to shoe-horn it into JDBC.