473,405 Members | 2,176 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Admin API equivalent to "db2 terminate"

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
Nov 12 '05 #1
6 4369
For an instance attachment, you want 'sqledtin()' to detach.

Since connect/disconnect are SQL, there are no equivalent apis for db
connections.

Dmitri wrote:
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

Nov 12 '05 #2
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

Nov 12 '05 #3
sqledtin does not rest values specified by "set client".
And I do need to reset attach_dbpartitionnum

Eg.
I attached to node 4 of EEE instance, than I decided to attached to a EE
instance which has only one node or EEE instance where I do not know number
of nodes or node sequence.
Ideally I would like to be able to reset value I specified in prior call to
"set client attach_dbpartitionnum", but it seems like the only way to do so
is "terminate". And I can not find the corresponding API call.

P.S.
In general Admin API suck - for example it's impossible to attach to two
different instances at the same time (sure I can create some proxy code, but
it's almost like reinventing the API)
For an instance attachment, you want 'sqledtin()' to detach.

Since connect/disconnect are SQL, there are no equivalent apis for db
connections.

Nov 12 '05 #4
I can not get a list of valid nodes until I attach and I can not attach
until I selected a node (or use default one).
Once I've selected one, there is no way to go back to a default (I can not
find a "terminate" analog)

-dmitri

"Amit" <aa***@hotmail.com> wrote in message
news:85**************************@posting.google.c om...
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.

Nov 12 '05 #5
You need to create a new context and set the node number and create an
attachment within the new context. You can look at the following
functions to see how to use contexts (it doean't have to be
multithreaded)

* sqleAttachToCtx - Attach to Context
* sqleBeginCtx - Create and Attach to an Application Context
* sqleDetachFromCtx - Detach From Context
* sqleSetTypeCtx - Set Application Context Type

"Dmitri" <chuzhoi_at_yahoo_dot_com> wrote in message news:<ZL********************@comcast.com>...
I can not get a list of valid nodes until I attach and I can not attach
until I selected a node (or use default one).
Once I've selected one, there is no way to go back to a default (I can not
find a "terminate" analog)

-dmitri

"Amit" <aa***@hotmail.com> wrote in message
news:85**************************@posting.google.c om...
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.

Nov 12 '05 #6
Thanks a lot, it's working now.
I've seen *Ctx methods before, but I was under impression those API calls
are for connection sharing across threads.
Now I can easily implement multi-instance attachment in one application.

thanks,
Dmitri
Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Prem K Mehrotra | last post by:
I come from Oracle background. In Oracle, when one wants to do a point in time recovery, one can specify recover database until timestmap. Oracle's database maps to a db2 subsystem, i.e., in...
1
by: LazyAnt | last post by:
Does DB2 process "ALL" subquery by "nested iteration" strategy, or using its own special algorithm? For example, assume r(A, B, C) and s(D, E, F) are two relations, consider the following query:...
0
by: Jennifer Palonus | last post by:
One of our customers reported a strange problem with our app, running on Win2003 Server: We have two VC++6 (classic C++) .exe's that talk to each other - an MFC app talking to a COM server....
2
by: Ingrid | last post by:
Hola a todos Tengo instalado db2 udb wse en su pc y necesito conectar a varios usuarios utilizando el administration client, logro hacer la coneccion pero el usuario administrador en forma...
0
by: wxqun | last post by:
I'm try tuning a SELECT statement which is used by a Cognos cube on a DB2 V7.2 +FP13. After I did the tuning, the "dynexpln" shows the "total cost" is down to 8214567 from 37345265, also I try to...
1
by: jyoti202 | last post by:
Hi, Need help for this as i have been looking for it but could not get any results. We are using java as front end and DB2 as backend, i m getting the exception while executing a particular...
1
by: lunaliena | last post by:
Hi everyone! I'm going nuts in searching if the NSE for 9.0 and 9.1 are equivalent... (except for the fact that 9.0 was free) Can anyone help me? TNX lunaliena
4
by: Rahul B | last post by:
Hi, When i do a "db2 list applications", i get the required applications with their ip addresses. However, some of the application Ids are ip addresses while some application Ids are...
1
by: Kozy | last post by:
Hello everyone, I have a problem with federation between Oracle and DB2. Once every few weeks my DB2 federation request "dies". What happens is DB2 thinks it is still geting information from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.