If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to get application name with select statement?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-13-09, 03:23
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
How to get application name with select statement?

Hi,
using db2 v9.5 fp2 on Linux I would like to write select statement that would return current application name.

I can write: "db2 list application" which returns:
Code:
Auth Id  Application    Appl.      Application Id
         Name           Handle
-------- -------------- ---------- -----------------------------
GROFATY  db2bp          15374      C0A804A0.KE0B.021543042035
I know I can get "Application Id" with select:
Code:
select application_id() from sysibm.sysdummy1
but how to get "Application Name"? In my case "db2bp".

I need this "Application Name" info because I would like to create trigger to collect application name which updated the record.
Regards,
Grofaty

Last edited by grofaty; 10-13-09 at 03:30.
Reply With Quote
  #2 (permalink)  
Old 10-13-09, 06:00
Mathew_paul Mathew_paul is offline
Registered User
 
Join Date: Oct 2007
Posts: 200
try with snapshot functions
select * from table(snapshot_appl_info('',-1)) as tt
regds
Paul
Reply With Quote
  #3 (permalink)  
Old 10-13-09, 09:43
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
db2 "select substr(APPL_NAME,1,30) from SYSIBMADM.APPLICATIONS"
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #4 (permalink)  
Old 10-15-09, 10:42
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
There is an APPLICATION_ID scalar function too
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #5 (permalink)  
Old 10-16-09, 06:10
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
Very often you will see "java" which does not add too much info. In this context I want to draw your attention to this: Java Program Name for DB2 | db2ude
Nice liitle feature if you ask me.
Reply With Quote
  #6 (permalink)  
Old 10-16-09, 11:11
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
Dr_t, you just earned another cup of java

That is a neat little code that should be utilized in all java code, specially as more teams use the same DB, you have to have an ability to know who is who.

Thank you.
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On