| Author |
Message |
Gert van der Kooij *nix forums Guru Wannabe
Joined: 27 May 2005
Posts: 267
|
Posted: Wed Jul 19, 2006 6:53 pm Post subject:
Re: how to get agent id
|
|
|
In article <1153321751.452515.151670@i3g2000cwc.googlegroups.com>,
udbadmin@gmail.com says...
| Quote: | are there more functions like this
i know there must not be function like AGENT_ID() otherwise you guys
must have mentioned but i am curious if there are more functions like
this which could be useful
|
You can find all supported functions in the online library at
http://tinyurl.com/g4rou
or the original wrapped url
<http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?
topic=/com.ibm.db2.udb.doc/admin/r0011043.htm> |
|
| Back to top |
|
 |
jefftyzzer *nix forums beginner
Joined: 27 Jun 2006
Posts: 12
|
Posted: Wed Jul 19, 2006 6:35 pm Post subject:
Re: how to get agent id
|
|
|
First thing: as Serge pointed out, you don't need "= VALUES(...", just
call the function directly as he illustrated--my mistake. As to your
question, I wouldn't say there are many functions like that, but there
is a lot of information available in snapshot table functions like
SNAPSHOT_APPL and SNAPSHOT_APPL_INFO.
--Jeff
crazy_jutt wrote:
| Quote: | are there more functions like this
i know there must not be function like AGENT_ID() otherwise you guys
must have mentioned but i am curious if there are more functions like
this which could be useful
crazy_jutt wrote:
thanks guys
i got it
here it what i did
db2 -x "SELECT APPL.AGENT_ID FROM TABLE(SNAPSHOT_APPL_INFO('PROD1',-2))
AS APPL WHERE APPL.APPL_ID = (VALUES APPLICATION_ID())" | read agent_id
echo ${agent_id}
jefftyzzer wrote:
Doh! Nothing speaks against it--I just like to waste keystrokes .
Good catch.
-- Jeff
Serge Rielau wrote:
jefftyzzer wrote:
APPL.APPL_ID = (VALUES APPLICATION_ID()));--
What speaks against
APPL.APPL_ID = APPLICATION_ID() ??
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
IOD Conference
http://www.ibm.com/software/data/ondemandbusiness/conf2006/ |
|
|
| Back to top |
|
 |
udbadmin@gmail.com *nix forums beginner
Joined: 16 Nov 2005
Posts: 8
|
Posted: Wed Jul 19, 2006 3:09 pm Post subject:
Re: how to get agent id
|
|
|
are there more functions like this
i know there must not be function like AGENT_ID() otherwise you guys
must have mentioned but i am curious if there are more functions like
this which could be useful
crazy_jutt wrote:
| Quote: | thanks guys
i got it
here it what i did
db2 -x "SELECT APPL.AGENT_ID FROM TABLE(SNAPSHOT_APPL_INFO('PROD1',-2))
AS APPL WHERE APPL.APPL_ID = (VALUES APPLICATION_ID())" | read agent_id
echo ${agent_id}
jefftyzzer wrote:
Doh! Nothing speaks against it--I just like to waste keystrokes .
Good catch.
-- Jeff
Serge Rielau wrote:
jefftyzzer wrote:
APPL.APPL_ID = (VALUES APPLICATION_ID()));--
What speaks against
APPL.APPL_ID = APPLICATION_ID() ??
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
IOD Conference
http://www.ibm.com/software/data/ondemandbusiness/conf2006/ |
|
|
| Back to top |
|
 |
udbadmin@gmail.com *nix forums beginner
Joined: 16 Nov 2005
Posts: 8
|
Posted: Wed Jul 19, 2006 2:56 pm Post subject:
Re: how to get agent id
|
|
|
thanks guys
i got it
here it what i did
db2 -x "SELECT APPL.AGENT_ID FROM TABLE(SNAPSHOT_APPL_INFO('PROD1',-2))
AS APPL WHERE APPL.APPL_ID = (VALUES APPLICATION_ID())" | read agent_id
echo ${agent_id}
jefftyzzer wrote:
| Quote: | Doh! Nothing speaks against it--I just like to waste keystrokes .
Good catch.
-- Jeff
Serge Rielau wrote:
jefftyzzer wrote:
APPL.APPL_ID = (VALUES APPLICATION_ID()));--
What speaks against
APPL.APPL_ID = APPLICATION_ID() ??
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
IOD Conference
http://www.ibm.com/software/data/ondemandbusiness/conf2006/ |
|
|
| Back to top |
|
 |
jefftyzzer *nix forums beginner
Joined: 27 Jun 2006
Posts: 12
|
Posted: Wed Jul 19, 2006 1:53 am Post subject:
Re: how to get agent id
|
|
|
Doh! Nothing speaks against it--I just like to waste keystrokes .
Good catch.
-- Jeff
Serge Rielau wrote:
|
|
| Back to top |
|
 |
Serge Rielau *nix forums Guru
Joined: 29 Apr 2005
Posts: 1583
|
Posted: Wed Jul 19, 2006 1:13 am Post subject:
Re: how to get agent id
|
|
|
jefftyzzer wrote:
| Quote: | APPL.APPL_ID = (VALUES APPLICATION_ID()));--
What speaks against |
APPL.APPL_ID = APPLICATION_ID() ??
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
IOD Conference
http://www.ibm.com/software/data/ondemandbusiness/conf2006/ |
|
| Back to top |
|
 |
udbadmin@gmail.com *nix forums beginner
Joined: 16 Nov 2005
Posts: 8
|
Posted: Tue Jul 18, 2006 9:10 pm Post subject:
Re: how to get agent id
|
|
|
how can i use this in dynamic SQL ?
jefftyzzer wrote:
| Quote: | How about something like:
SELECT
APPL.AGENT_ID
FROM
TABLE (SNAPSHOT_APPL_INFO('<YOUR DB NAME>',-1)) AS APPL
WHERE
APPL.APPL_ID = (VALUES APPLICATION_ID());
and by extension
BEGIN ATOMIC
DECLARE AGNT BIGINT;--
SET AGNT =
(SELECT
APPL.AGENT_ID
FROM
TABLE (SNAPSHOT_APPL_INFO('CSE1DV00',-1)) AS APPL
WHERE
APPL.APPL_ID = (VALUES APPLICATION_ID()));--
END;
HTH,
--Jeff
crazy_jutt wrote:
hello,
How can i retreive agent id in return when i connect to database and
run some sql?
can i do something like
db2 connect to database1
agent_id = db2 "select * from abc" |
|
|
| Back to top |
|
 |
jefftyzzer *nix forums beginner
Joined: 27 Jun 2006
Posts: 12
|
Posted: Tue Jul 18, 2006 7:57 pm Post subject:
Re: how to get agent id
|
|
|
How about something like:
SELECT
APPL.AGENT_ID
FROM
TABLE (SNAPSHOT_APPL_INFO('<YOUR DB NAME>',-1)) AS APPL
WHERE
APPL.APPL_ID = (VALUES APPLICATION_ID());
and by extension
BEGIN ATOMIC
DECLARE AGNT BIGINT;--
SET AGNT =
(SELECT
APPL.AGENT_ID
FROM
TABLE (SNAPSHOT_APPL_INFO('CSE1DV00',-1)) AS APPL
WHERE
APPL.APPL_ID = (VALUES APPLICATION_ID()));--
END;
HTH,
--Jeff
crazy_jutt wrote:
| Quote: | hello,
How can i retreive agent id in return when i connect to database and
run some sql?
can i do something like
db2 connect to database1
agent_id = db2 "select * from abc" |
|
|
| Back to top |
|
 |
jagdip@gmail.com *nix forums beginner
Joined: 23 Jun 2005
Posts: 25
|
Posted: Tue Jul 18, 2006 4:30 pm Post subject:
Re: how to get agent id
|
|
|
I am doing load pipe using unix pipes
sometime load fails and export still keep on pushing data into pipe
i want to kill that export when load fails and vise versa
Knut Stolze wrote:
| Quote: | crazy_jutt wrote:
hello,
How can i retreive agent id in return when i connect to database and
run some sql?
can i do something like
db2 connect to database1
agent_id = db2 "select * from abc"
You could write a not fenced UDF that invokes the C function "getpid" and
return its result. Depending on your platform, you may need the thread-id
as well.
But the real question is: what do you want to do with this number?
--
Knut Stolze
DB2 Information Integration Development
IBM Germany |
|
|
| Back to top |
|
 |
Knut Stolze *nix forums Guru
Joined: 28 Jul 2005
Posts: 755
|
Posted: Tue Jul 18, 2006 4:03 pm Post subject:
Re: how to get agent id
|
|
|
crazy_jutt wrote:
| Quote: | hello,
How can i retreive agent id in return when i connect to database and
run some sql?
can i do something like
db2 connect to database1
agent_id = db2 "select * from abc"
|
You could write a not fenced UDF that invokes the C function "getpid" and
return its result. Depending on your platform, you may need the thread-id
as well.
But the real question is: what do you want to do with this number?
--
Knut Stolze
DB2 Information Integration Development
IBM Germany |
|
| Back to top |
|
 |
udbadmin@gmail.com *nix forums beginner
Joined: 16 Nov 2005
Posts: 8
|
Posted: Tue Jul 18, 2006 3:54 pm Post subject:
how to get agent id
|
|
|
hello,
How can i retreive agent id in return when i connect to database and
run some sql?
can i do something like
db2 connect to database1
agent_id = db2 "select * from abc" |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|