1

I want to achieve federation using following commands through JDBC.

connect to SIGCAP_M user db2sigcp using db2sigcp ;

drop wrapper drda;
create wrapper drda ;

UNCATALOG NODE XYZ;
CATALOG TCPIP NODE XYZ REMOTE 10.XXX.XX.XX SERVER 446 ostype OS400;

UNCATALOG DB as4xyz;
CATALOG DCS DATABASE as4xyz as as4xyz;
CATALOG DB as4xyz as as4xyz AT NODE xyz authentication DCS ;

attach to xyz user "kasparov" using "kasparov123";

drop server xyz;
create server xyz type DB2/400 version 7 wrapper DRDA authorization db2ngicp PASSWORD db2ngicp options( add dbname 'S845F85V', DB2_TWO_PHASE_COMMIT  'Y'  ) ;

CREATE USER MAPPING FOR db2sigcp SERVER EQUATION OPTIONS ( ADD REMOTE_AUTHID 'db2ngicp',ADD REMOTE_PASSWORD 'db2ngicp') ;

CREATE nickname E_NEPF FOR as4xyz.KFILLV.NEPF;

As per IBM documentation - https://www.ibm.com/support/knowledgecenter/SSEPGG_10.5.0/com.ibm.db2.luw.sql.rtn.doc/doc/r0012547.html

SYSPROC.ADMIN_CMD doesn't support any of the above commands. How can I make this work?

3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.