Method 1. Connect to the database from the command line and read the herald message:
$ db2 connect to mydb Database Connection Information Database server = DB2/LINUXX8664 9.7.1 SQL authorization ID = DB2INST5 Local database alias = AOL_MM
Method 2. Retrieve the version from the system table:
$ db2 "select * from SYSIBM.SYSVERSIONS" VERSIONNUMBER VERSION_TIMESTAMP AUTHID VERSIONBUILDLEVEL ------------- -------------------------- -------- ----------------- 9070100 2011-10-10-14.38.42.064608 DB2INST5 s091114 1 record(s) selected.
Method 3. Get the version directly using the 'db2level' command:
$ db2level DB21085I Instance "db2inst5" uses "64" bits and DB2 code release "SQL09071" with level identifier "08020107". Informational tokens are "DB2 v9.7.0.1", "s091114", "IP23034", and Fix Pack "1". Product is installed at "/opt/ibm/db2/V9.7".
Method 4. The Database Manager snapshot, among other interesting information, also contains the version:
$ db2 get snapshot for dbm | grep -P "(Product name|Service level)" Product name = DB2 v9.7.0.1 Service level = s091114 (IP23034)
$ db2 connect to mydb Database Connection Information Database server = DB2/LINUXX8664 9.7.1 SQL authorization ID = DB2INST5 Local database alias = AOL_MM