Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2003
    Posts
    1,605

    Unanswered: 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 04:30.

  2. #2
    Join Date
    Oct 2007
    Posts
    246
    try with snapshot functions
    select * from table(snapshot_appl_info('',-1)) as tt
    regds
    Paul

  3. #3
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    db2 "select substr(APPL_NAME,1,30) from SYSIBMADM.APPLICATIONS"
    --
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows

    DB2 v9.7.0.6 os 6.1.0.0

  4. #4
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    There is an APPLICATION_ID scalar function too
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  5. #5
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    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.

  6. #6
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    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.7.0.6 os 6.1.0.0

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •