Is there a db2 function/procedure/variable that can be used to determine what platform a data source origins from? sysibm.sysdummy1 exists, so I assume that this is Db2, but some of the SQL does not look right according to LUW syntax. Is there an easy way to figure out via SQL what platform a data source origins from?
DB2 Cross Platform Function and Variable Compatibility
db2db2-luwdb2-midrangedb2-zos
Related Question
- DB2 LUW Timestamp differences in versions
- Db2 – Use of SET INTEGRITY for DETACH PARTITION
- Db2 – How to identify overflow rows in DB2 LUW
- Db2 – History Question: DB2 Nomenclature
- DB2 – how to call a stored procedure that returns a result set in another user defined table function
- DB2 – Handling Linked Server Table Locks
- DB2 – Equivalent of Oracle DBMS_LOB.SUBSTR
- Db2 – How to identify row change timestamp columns in Db2 Table
Best Answer
It's a very open-ended question, as there is no sure-fire method to determine the server version and platform. You'll need to apply some heuristics.
In Db2 for LUW (and only LUW) since v 10.1 there's a system view
dbmcfg
that can return the server version:so if it succeeds you'll be sure it's Db2 for LUW of certain release level. Similarly, since v 9.7 you can query
sysibmadm.env_inst_info
(or first search for it insyscat.tables
).Another indicator of Db2 for LUW is the presence of some Oracle-compatible views since v.9.7, e.g.
syspublic.dual
orsysibmadm.all_objects
.A good indicator of Db2 for z/OS would be the presence of mainframe-specific catalog tables, e.g.
sysibm.locations
orsysibm.syscopy
, which go back to v9 at least.The presence of catalog views in the
QSYS
andQSYS2
schemas, e.g.QSYS2.TABLES
, will indicate Db2 for i (AS/400).Neither Db2 for z/OS nor Db2 for i have the
SYSCAT
schema views.