sqlibm-midrangedb2-400

SQL Query to Get DB2 Version on IBM i


I would like to find out which version of DB2 we are running on our IBM i server using only SQL SELECT.

I am executing my queries via installed ODBC drivers for i Access. The places I am executing the queries are Excel-ODBC and Excel-Microsoft Query (simply because I am not a developer and therefore don't have/don't know of another place to run queries).

The following solutions do not work for me:

How to check db2 version

Get DB2 instance name using SQL

Basic reasons why I have failed to get the above solutions to work:

  1. I do not have a SYSPROC table/have access to SYSPROC table
  2. SYSIBMADM table does not contain a ENV_INST_INFO table.
  3. I think these answers may be tailored to those using IBM z, but I use IBM i.

My end goal is to be able to execute a SQL SELECT and get the version of DB2 used on our server.


Solution

  • Try this:

    SELECT RELEASE_LEVEL, TEXT_DESCRIPTION
    FROM QSYS2.SOFTWARE_PRODUCT_INFO
    WHERE PRODUCT_ID = '5770SS1' 
    AND PRODUCT_OPTION = '27'
    --or this instead of the above line:
    --AND LOAD_TYPE = 'CODE' AND PRODUCT_OPTION = '*BASE'