niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » IBM DB2
how to get agent id
Post new topic   Reply to topic Page 1 of 1 [11 Posts] View previous topic :: View next topic
Author Message
udbadmin@gmail.com
*nix forums beginner


Joined: 16 Nov 2005
Posts: 8

PostPosted: Tue Jul 18, 2006 3:54 pm    Post subject: how to get agent id Reply with 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
Knut Stolze
*nix forums Guru


Joined: 28 Jul 2005
Posts: 755

PostPosted: Tue Jul 18, 2006 4:03 pm    Post subject: Re: how to get agent id Reply with quote

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
jagdip@gmail.com
*nix forums beginner


Joined: 23 Jun 2005
Posts: 25

PostPosted: Tue Jul 18, 2006 4:30 pm    Post subject: Re: how to get agent id Reply with quote

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
jefftyzzer
*nix forums beginner


Joined: 27 Jun 2006
Posts: 12

PostPosted: Tue Jul 18, 2006 7:57 pm    Post subject: Re: how to get agent id Reply with 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:
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
udbadmin@gmail.com
*nix forums beginner


Joined: 16 Nov 2005
Posts: 8

PostPosted: Tue Jul 18, 2006 9:10 pm    Post subject: Re: how to get agent id Reply with quote

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
Serge Rielau
*nix forums Guru


Joined: 29 Apr 2005
Posts: 1583

PostPosted: Wed Jul 19, 2006 1:13 am    Post subject: Re: how to get agent id Reply with quote

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
jefftyzzer
*nix forums beginner


Joined: 27 Jun 2006
Posts: 12

PostPosted: Wed Jul 19, 2006 1:53 am    Post subject: Re: how to get agent id Reply with quote

Doh! Nothing speaks against it--I just like to waste keystrokes Smile.
Good catch.

-- Jeff

Serge Rielau wrote:
Quote:
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

PostPosted: Wed Jul 19, 2006 2:56 pm    Post subject: Re: how to get agent id Reply with 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:
Quote:
Doh! Nothing speaks against it--I just like to waste keystrokes Smile.
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

PostPosted: Wed Jul 19, 2006 3:09 pm    Post subject: Re: how to get agent id Reply with 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:
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 Smile.
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

PostPosted: Wed Jul 19, 2006 6:35 pm    Post subject: Re: how to get agent id Reply with quote

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 Smile.
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
Gert van der Kooij
*nix forums Guru Wannabe


Joined: 27 May 2005
Posts: 267

PostPosted: Wed Jul 19, 2006 6:53 pm    Post subject: Re: how to get agent id Reply with quote

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
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [11 Posts] View previous topic :: View next topic
The time now is Thu Nov 20, 2008 9:59 pm | All times are GMT
navigation Forum index » Databases » IBM DB2
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Virutal Delivery Agent Delivry Failure Indication Kevin Wilcox Postfix 15 Tue Jul 18, 2006 1:11 am
No new posts virtual_mailbox_maps not needed when using non-postfix de... Darren Postfix 1 Wed Jul 12, 2006 10:01 am
No new posts I have 100 servers which need a new backup server added t... gavino python 13 Sat Jul 01, 2006 10:34 am
No new posts Local/Virtual Delivery Agent Config Question Kevin Wilcox Postfix 3 Fri Jun 30, 2006 9:08 pm
No new posts Server side filtering with virtual delivery agent Hideki Okubo Postfix 4 Sat Jun 24, 2006 9:45 pm

Mortgage Calculator | SMS-Sprüche | Loans | Debt Consolidation | Reviews
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.5051s ][ Queries: 16 (0.4039s) ][ GZIP on - Debug on ]