Reputation: 121
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:
Get DB2 instance name using SQL
Basic reasons why I have failed to get the above solutions to work:
My end goal is to be able to execute a SQL SELECT and get the version of DB2 used on our server.
Upvotes: 0
Views: 2553
Reputation: 1
Thank you.
Both of these statements provided the desired results on my server
SELECT RELEASE_LEVEL, TEXT_DESCRIPTION
FROM QSYS2.SOFTWARE_PRODUCT_INFO
WHERE PRODUCT_ID = '5770SS1'
AND LOAD_TYPE = 'CODE' AND PRODUCT_OPTION = '*BASE'
Release level: V7R5M0 Text description: IBM i
SELECT os_name, os_version, os_release
FROM SYSIBMADM.ENV_SYS_INFO;
OS_NAME:IBM i OS_VERSION: 7 OS_RELEASE: 5
Edited to add further details after reading about good answers in the help center:
My response provided two viable alternatives.
I was directed to these alternatives by stackoverflow responses.
Hopefully my response was legible. If it was not please comment and I will try to make it clearer.
I appreciate that stackoverflow exists, is user friendly, is supported by professional staff and professional contributors.
Although I looked for an answer to my question elsewhere, I should have gone to stack overflow first!
Upvotes: 0
Reputation: 23813
Another option
SELECT os_name, os_version, os_release
FROM SYSIBMADM.ENV_SYS_INFO;
Should work on 7.2+ which was released in 2014.
Upvotes: 1
Reputation: 12339
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'
Upvotes: 1