The Artima Developer Community
Sponsored Link

Java Answers Forum
JAVA x WMI

1 reply on 1 page. Most recent reply: Mar 4, 2003 12:27 PM by Natalia Carolina Maya Ortiz

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Fernando Pratti

Posts: 1
Nickname: fhpratti
Registered: Jan, 2003

JAVA x WMI Posted: Jan 9, 2003 4:18 PM
Reply to this message Reply
Advertisement
I'm trying do develop a Java tool that collect some information from Microsoft Windows Management Instrumentation (WMI) using the WMI ODBC driver.
But I can't get a connection. Does anyone know how to use Java to connect WMI throgh WMI ODBC driver?

First I installed and configured the driver. (I'm using win2000)
I wrote a simple test to connect but I can't get a connection.

This is my code:
import java.sql.*; // needed for JDBC access

public class Teste
{
public static void main(String args[])
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("ODBC Driver Found");
String url = "jdbc:odbc:WMI";
Connection con = DriverManager.getConnection(url, "john", "secret");
}
catch (ClassNotFoundException ex)
{
System.out.println("ODBC Driver not found");
System.err.println("Exception: " + ex.getMessage());
}
catch (SQLException ex)
{
System.out.println("Connection couldn't be established");
System.err.println("Exception: " + ex.getMessage());
}
catch (Exception ex)
{
System.err.println("Exception: " + ex.getMessage());
}
}
}

===

And I got this when running the code above:

ODBC Driver Found
Connection couldn't be established
Exception: [Microsoft][WBEM ODBC Driver]Unable to connect

===

Best regards,

Fernando Pratti.


Natalia Carolina Maya Ortiz

Posts: 1
Nickname: natalia
Registered: Mar, 2003

Re: JAVA x WMI Posted: Mar 4, 2003 12:27 PM
Reply to this message Reply
Hello!

I don't write you to help you, but to ask you a question.
I would like to know if you got to do what you say in your mail.

Thank you very much for your attention!!

Flat View: This topic has 1 reply on 1 page
Topic: Java help Previous Topic   Next Topic Topic: Java vs. Windows API

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use