Mapping WMI to ODBC

When using Open Database Connectivity (ODBC) to access WMI, the classes, properties, and values returned by WMI must be represented by ODBC in a consistent manner.

Note  For more information about support or requirements for installation on a specific operating system, see Operating System Availability of WMI Components.

The following sections are discussed in this topic:

Mapping WMI Namespaces to ODBC

WMI namespaces map to ODBC databases. In WMI, namespaces are represented by instances of the __NameSpace class. Namespaces can contain child namespaces, which can be enumerated like any other instance of a class.

Mapping WMI Classes and Properties to ODBC

WMI classes map to ODBC tables. The table qualifier is the fully qualified __NameSpace name. A class is unique. If a class exists in two different namespaces, the adapter maps them as two different tables.

The following table lists the mapping of WMI properties to ODBC table columns.

Property nameColumn name
Property valueColumn value
Property qualifiersColumn metadata


Mapping WMI Class Qualifiers to ODBC

Class qualifiers map to metadata of a table (as exposed through SQLTables). A sixth column of the rowset has been added to SQLTables to return all class qualifiers as a SQL_LONGVARCHAR. The adapter exposes qualifiers on a per-class basis only. Therefore, the adapter does not access class qualifier information that varies across instances.

Mapping WMI Property Qualifiers to ODBC

The property qualifiers are exposed to the ODBC clients by using SQLColumns. Some of the metadata is used to determine the standard metadata exposed by SQLColumns. All qualifiers are contained as a SQL_LONGVARCHAR in a thirteenth column added to the resultant rowset. The adapter only exposes qualifiers on a per-class basis, not on a per-class, per-instance basis. Therefore, the adapter does not access property qualifier information that varies across instances.

Mapping WMI Arrays to ODBC

WMI supports multiple array types. These array types are returned as their basic unit type in multiple ODBC instances. One WMI instance with array type properties maps onto multiple ODBC instances.

For example, a table has two columns: MyKey and MyData. MyKey is a standard integer type while MyData is an array type. The following table is an example of a table in the WMI database (two WMI instances).

112, 24
26, 100, 255


The WMI ODBC adapter returns the following instances back to the client application (five ODBC instances).



Note  WMI class and property qualifiers that change with the instance of a class are not exposed. WMI associations are only exposed when they are represented by classes. Thus, foreign keys are not used in a table to relate the classes of an association.