Re: Client "Host not found"

Tech-Archive recommends: Fix windows errors by optimizing your registry





lujate wrote:

The ping command was ran from a command line, PING 'x.x.x.x'.

Here is the java code:
--------------------------------------------------------------------------------------------
import java.sql.*;

public class Jdbc {
public static void main (String args[]) throws Exception {
try {
java.lang.Class.forName
("com.microsoft.sqlserver.jdbc.SQLServerDriver");

Connection c = java.sql.DriverManager.getConnection
("jdbc:sqlserver://x.x.x.x;user=Anonymous;password=guest;");

System.out.println("Connected");
}
catch (SQLException se) {
do {
System.out.println("SQL STATE: " + se.getSQLState());
System.out.println("ERROR CODE: " + se.getErrorCode());
System.out.println("MESSAGE: " + se.getMessage());
System.out.println();
se = se.getNextException();
} while (se != null);

se.printStackTrace();
}
}
}
--------------------------------------------------------------------------------------------
And the stack trace.

java.lang.NullPointerException

at java.lang.Throwable.<init>(Throwable.java:180)

at java.lang.Exception.<init>(Exception.java:29)

at java.lang.RuntimeException.<init>(RuntimeException.java:32)

at
java.lang.NullPointerException.<init>(NullPointerException.java:36)
at Jdbc.main(Jdbc.java:6)

Is ther something wrong with your JVM? What's
line 6 of your program? I don't even see where
an NPE could occur. Would you try this:

import java.sql.*;
import java.util.*;
public class Jdbc {
public static void main (String args[]) throws Exception {
try {

Properties props = new java.util.Properties();
props.put("user", "Anonymous");
props.put("password", "guest");

Driver d =
(Driver)
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
System.out.println("Instantiated driver");

Connection c = d.connect("jdbc:sqlserver://x.x.x.x", p);

System.out.println("Connected");
}
catch (Exception e) {
e.printStackTrace();
}
}
}




.



Relevant Pages

  • SMTP mailing problem (sending 1000 messages)
    ... The exception in below. ... Binder binder, Object target, Objectargs, ParameterModifiermodifiers, ... CultureInfo culture, String[] namedParameters) ...
    (microsoft.public.inetserver.iis.smtp_nntp)
  • SMTP mailing problem (sending 1000 messages)
    ... The exception in below. ... Binder binder, Object target, Objectargs, ParameterModifiermodifiers, ... CultureInfo culture, String[] namedParameters) ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Xlint " warning: [unchecked] unchecked conversion"
    ... public static void main(Stringargs) throws Exception { ... Hashtable <String, Vector<String>> ht = ... conversion" warning for that line in main? ...
    (comp.lang.java.programmer)
  • Re: problem with change to exceptions
    ... You can pass to the exception: ... a string ... In your case there is no message, no values so args is NoneType. ...
    (comp.lang.python)
  • Re: Client "Host not found"
    ... The ping command was ran from a command line, ... public static void main (String args[]) throws Exception { ...
    (microsoft.public.sqlserver.jdbcdriver)