You could prevent the user from specifying a node number - instead
have them select from a list of valid nodes for the database/instance.
This way the users will never be able to specify an invalid node.
You can get the default node number as by calling the get snapshot
function at database manager level before setting DB2NODE. The
node_number (from the collected grouping) will give you the default
node number for your attachments.
You can get the the list of valid nodes for the database by using the
query:
select distinct (dbpartitionnum) from syscat.dbpartitiongroupdef; (use
node and nodegroupdef for v7)
You can get a list of all participant nodes for the instance by using
the following query:
SELECT * FROM TABLE(DB_PARTITIONS()) A;
Of course the disadvantage of this method is that you will need to
have a connection to a database on the instance.
Another sneaky way to get the nodes for an instance is to take a
global snapshot for the database manager and use the node list from
the FCM send/recieve metrics.
thanks
Amit (singleton AT canada DOT com)
"Dmitri" <chuzhoi_at_yahoo_dot_com> wrote in message news:<46********************@comcast.com>...
Hi there,
Does anybody know what is DB2 UDB admin API equivalent to "db2 terminate"
command?
Some background:
I'm developing monitoring application(http://chuzhoi_files.tripod.com). I
want to be able to specify a node number during attachment, so I'm using
sqlesetc (API for "set client attach_dbpartitionum" command). If user
specifies an incorrect node number, DB2 will fail with something like:
SQL1469N Instance "DB2" (nodenum "1") does not have node "1" specified in
its db2nodes.cfg file. SQLSTATE=08004
In this case, I want to be able to reset active node to a "default" state,
but It seems like the only way to reset is to use "terminate" command and I
can not find corresponding API call.
I've tried to query client information BEFORE executing "set client", but
attach_dbpartionnum info is empty(-1/65535), if DB2NODE is not set.
I can always fall back to "0" as default node number (and it might work for
most of the configurations), but it's possible for some configuarions not to
have node 0.
thanks in advance,
Dmitri