db2 CREATE DATABASE XYZ
db2 DROP DATABASE XYZ
These db2 commands which doesn't provide support to specify username/password while executing on db2cmd/db2clp for a specific user other than machine logged-in user. Hence result a exception
"SQL1092N The requested command or operation failed because the user ID does not have the authority to perform the requested command or operation."
And when the same commands run as by choosing 'Run as different user', it works properly.
1. But I need to use same mechanism from Java code, but don't know how. Is it possible to open installed db2's clp as a different user form Java code??
2. Is it possible to associate username/password in create/drop commands?