ODBC: WBEM driver

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Petr Toman

    ODBC: WBEM driver

    Hello,
    I would like to access W2K Eventlog from PHP via ODBC - access to the
    system is enabled by "WBEM Driver" (supplied on the W2K CD). My code
    looks like this:

    $connection = odbc_connect("W BEM Source", "", "")
    or die(odbc_errorm sg());

    $select = "SELECT * FROM Win32_NTLogEven t WHERE Logfile =
    'Application'";

    $query_result = odbc_do($connec tion, $select)
    or die(odbc_errorm sg());

    odbc_fetch_row( $query_result);
    echo odbc_result ($query_result, 1);
    odbc_close($con nection);

    Error produced: "Warning: odbc_do(): SQL error: [Microsoft][WBEM ODBC
    Driver][ISAM]Failed to obtain provider interface, SQL state S0000 in
    SQLExecDirect".

    I suspect I need to pass WMI namespace 'root\cimv2' to the
    odbc_connect() function (like with
    C:\WINNT\system 32\wbem\wbemtes t.exe) - but HOW? I've found only
    examples for ASP or VB on the Internet. Thanks in advance.

    Links:

    Querying with WQL


    Mapping WMI to ODBC

Working...