Db2

 View Only

 Obtain Db2 Product name via query

Mark Gillis's profile image
Mark Gillis IBM Champion posted Wed July 02, 2025 06:55 AM

Hi

I am trying to put together some SQL to give me the Product Name of a Db2 instance. I can see the details via db2licm i.e.

Product name:                     "DB2 Advanced Enterprise Server Edition"
I'm aware the Product Name can be obtained from MON_GET_INSTANCE but it's a different value:

db2 "select PRODUCT_NAME FROM TABLE (MON_GET_INSTANCE(-2))"

PRODUCT_NAME
--------------------------------
DB2 v12.1.1.0

Anyone know what can be used in the SQL to get the edition data?

Regards

Mark Gillis

Madhusudan S M's profile image
Madhusudan S M

You can retrieve the product full name by using the query:

SELECT * from sysibmadm.env_prod_info where LICENSE_INSTALLED ='Y'

Jan Nelken's profile image
Jan Nelken IBM Champion

Mark, as far as I know - thee are no API i/f to license information; so you have basically two options:

- rely on your awk skills to parse output of db2licm -l command :-)
- parse info from nodelock:

db2inst1@Tablecik:~$ cat /opt/ibm/db2/V12.1/license/nodelock
#8196c4de670cedde2419392f2aff4ba1f07242b0ece83939c993d90f62a675b8 DerivedLicenseAggregateDuration=90,DerivedLicenseEndDate=09/25/2025,DerivedLicenseStartDate=06/27/2025,LicenseDuration=90,LicenseEndDate=09/25/2025,LicenseStartDate=06/27/2025,ProductAnnotation=5;(_t),ProductID=1413,ProductName=DB2 Enterprise Server Edition,ProductVersion=12.1,TrialExpDate=1758977583,
fa8c63c6836c9176b8656f8761c0bb85f522bed0fe64e2dbdefc5d2415f3f2fc DerivedLicenseAggregateDuration=90,DerivedLicenseEndDate=09/25/2025,DerivedLicenseStartDate=06/27/2025,LicenseDuration=90,LicenseEndDate=09/25/2025,LicenseStartDate=06/27/2025,ProductAnnotation=5;(_t),ProductID=1404,ProductName=DB2 Advanced Edition,ProductVersion=12.1,TrialExpDate=1759239984,

Madhusudan S M's profile image
Madhusudan S M
db2 "select installed_prod_fullname from sysibmadm.env_prod_info"
 
INSTALLED_PROD_FULLNAME
----------------------------------------------------------------------------------------------------
DB2_ENTERPRISE_SERVER_EDITION
Jan Nelken's profile image
Jan Nelken IBM Champion

@Madhudusan:

I don't think it is the best method:

- firstly it requires connection to an existing database; what if you want to check Installed product on server without installed databases?
- secondly, it is confused in my environment:

db2licm -l says:

db2inst1@Tablecik:~$ db2licm -l
Product name:                     "DB2 Advanced Edition"
License type:                     "Trial"
Expiry date:                      "09/30/2025"
Product identifier:               "db2adv"
Version information:              "12.1"

while your query states:

INSTALLED_PROD             INSTALLED_PROD_FULLNAME                                                                              LICENSE_INSTALLED PROD_RELEASE               LICENSE_TYPE
-------------------------- ---------------------------------------------------------------------------------------------------- ----------------- -------------------------- --------------------------------------------------
ESE                        DB2_ENTERPRISE_SERVER_EDITION                                                                        N                 12.1                       -
AESE                       DB2_ADVANCED_ENTERPRISE_SERVER_EDITION                                                               N                 12.1                       -
AWSE                       DB2_ADVANCED_WORKGROUP_SERVER_EDITION                                                                N                 12.1                       -
WSE                        DB2_WORKGROUP_SERVER_EDITION                                                                         N                 12.1                       -
DAE                        DB2_DIRECT_ADVANCED_EDITION                                                                          N                 12.1                       -
DSE                        DB2_DIRECT_STANDARD_EDITION                                                                          N                 12.1                       -
DEC                        DB2_DEVELOPER_C_EDITION                                                                              N                 12.1                       -
STARTER                    DB2_STARTER_EDITION                                                                                  N                 12.1                       -
ADV                        DB2_ADVANCED_EDITION                                                                                 N                 12.1                       TRIAL
STD                        DB2_STANDARD_EDITION                                                                                 N                 12.1                       -
LITE                       DB2_LITE_EDITION                                                                                     N                 12.1                       -
BASE                       DB2_BASE_EDITION                                                                                     N                 12.1

Mark Gillis's profile image
Mark Gillis IBM Champion

I think this will do the trick for me thanks @Madhusudan S M. I have to be connected to the database anyway (it's going to be part of a series of SQL executions). 

We can probably limit your output to something specific @Jan Nelken if we just change it to this:

SELECT * from sysibmadm.env_prod_info where LICENSE_Type is not null

Regards

Mark

Jan Nelken's profile image
Jan Nelken IBM Champion

Mark - it still defies my logic as Product Name is Installed product - so connection to database is not needed - and in my case says License NOT installed:

db2inst1@Tablecik:~$ db2 "SELECT * from sysibmadm.env_prod_info where LICENSE_Type is not null"

INSTALLED_PROD             INSTALLED_PROD_FULLNAME                                                                              LICENSE_INSTALLED PROD_RELEASE               LICENSE_TYPE
-------------------------- ---------------------------------------------------------------------------------------------------- ----------------- -------------------------- --------------------------------------------------
ADV                        DB2_ADVANCED_EDITION                                                                                 N                 12.1                       TRIAL

  1 record(s) selected.