0

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?

  • Depends on the client you're using – mustaccio May 21 at 13:37
  • It doesn't look promising. :( They do offer a reference for cross platform development that apparently highlights the differences. – topshot May 21 at 14:08
  • @mustaccio, all I know is that I can put sql in a cdata tag and get the result back. I would like to ask a query that can identify the DBMS. If there is no such mechanism, perhaps there is some catalog table that only exists in LUW, some other that only exists on Z and similar for i. – Lennart May 21 at 15:31
2

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:

select value from sysibmadm.dbmcfg where name = 'release'

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 in syscat.tables).

Another indicator of Db2 for LUW is the presence of some Oracle-compatible views since v.9.7, e.g. syspublic.dual or sysibmadm.all_objects.

A good indicator of Db2 for z/OS would be the presence of mainframe-specific catalog tables, e.g. sysibm.locations or sysibm.syscopy, which go back to v9 at least.

The presence of catalog views in the QSYS and QSYS2 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.