![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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" |
#3
| |||
| |||
|
|
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 |
#4
| |||
| |||
|
|
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" |
#5
| |||
| |||
|
|
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" |
#6
| |||
| |||
|
|
APPL.APPL_ID = (VALUES APPLICATION_ID()));-- What speaks against |
#7
| |||
| |||
|
|
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/ond...ness/conf2006/ |
#8
| |||
| |||
|
|
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/ond...ness/conf2006/ |
#9
| |||
| |||
|
|
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/ond...ness/conf2006/ |
#10
| |||
| |||
|
|
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/ond...ness/conf2006/ |
![]() |
| Thread Tools | |
| Display Modes | |
| |