SQL STATE: 08S01
ERROR CODE: 0
MESSAGE: host.domain: Host host.domain not found
The host.domain returned is our iSeries system, which is the client not
the server. I can ping the SQL Server, so I know that the TCP/IP
connection is good.
I have been unable to determine any cause for this problem.
lujate wrote:
Show us the URL you're using for the connection attempt and
the ping command you're using. I would try:
Properties props = new Properties();
Driver d = new com.microsoft.sqlserver.jdbc.SQLServerDriver();
props.put("user", "sa");
props.put("password", "secret");
String myDBMSMachineIPAddress = "162.27.24.999"; // eg:
c = d.connect("jdbc:sqlserver://" + myDBMSMachineIPAddress + ":1433", props );
Joe Weinstein at BEA Systems
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)
lujate wrote:
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();
}
}
}
>
Instantiated driver
com.microsoft.sqlserver.jdbc.SQLServerException: host.domain: Host
host.domain not found
at java.lang.Throwable.<init>(Throwable.java:195)
at java.lang.Exception.<init>(Exception.java:41)
at java.sql.SQLException.<init>(SQLException.java:40)
at
com.microsoft.sqlserver.jdbc.SQLServerException.<init>(Unknown Source)
at
com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown
Source)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.build70Logon(Unknown
Source)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(Unknown Source)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown
Source)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown
Source)
at Jdbc.main(Jdbc.java:6)
> I tried your code and here's the output:
>
> Instantiated driver
>
> com.microsoft.sqlserver.jdbc.SQLServerException: host.domain: Host
> host.domain not found
> at java.lang.Throwable.<init>(Throwable.java:195)
There's definitely something funny going on with
your JVM and/or network config, but ping worked...
Hmmmmm. Try this program, to see if Java can open
a socket to the DBMS like a driver would:
import java.io.*;
import java.net.*;
public class isAnythingListeningOn
{
public static void main(String argv[])
throws Exception
{
if (argv.length != 2)
{
System.out.println("Usage: isAnythingListeningOn <host> <port>");
System.out.println("eg:\n% java isAnythingListeningOn myDBMSMachine 1433");
System.exit(0);
}
try
{
System.out.println("\nTrying to open a socket with host "
+ argv[0] + " and port " + argv[1] + " ...");
Socket socket = new Socket(argv[0],(new Integer(argv[1]).intValue()));
System.out.println("\nYes, there is, we got a socket.");
socket.close();
}
catch (Exception e)
{
System.out.println("We failed to open a socket. Here's why:\n");
e.printStackTrace();
System.out.println("\n(Either there is no machine named '" + argv[0]
+ "' or\nnothing is listening there on port "
+ argv[1] +")\n");
}
}
}
Joe Weinstein at BEA Systems
>
lujate wrote:
> "Yes, there is, we got a socket."
Ok, I'm stumped. I hope the MS folks can chip in.
Joe
Thanks
Did you get your problem fix? if you did, would you please post 'HOW' you
fix it?
Thanks,
Bunny
Evan
--------------------
>From: "Duncan Liu"<jean_li...@yahoo.com>
>Subject: Re: Client "Host not found"
>Date: Sat, 12 Jan 2008 06:10:28 +0800
>References: <441732DB...@bea.com> <1142356524....@j33g2000cwa.googlegroups.com> <4416FC3A...@bea.com>
<1142358494.2...@j33g2000cwa.googlegroups.com> <44170BA4...@bea.com> <1142363963.792462.260900
@j33g2000cwa.googlegroups.com> <44172F5F...@bea.com> <1142370652.0...@u72g2000cwu.googlegroups.com>
>
>Message-ID: <2574537ff2dd48da...@newspe.com>
>X-Mailer: http://www.umailcampaign.com, ip log:130.76.64.15
>Newsgroups: microsoft.public.sqlserver.jdbcdriver
>NNTP-Posting-Host: 22.bb.5446.static.theplanet.com 70.84.187.34
>Lines: 1
>Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP05.phx.gbl!newspe.com
>Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.sqlserver.jdbcdriver:412
>X-Tomcat-NG: microsoft.public.sqlserver.jdbcdriver
Evan T. Basalik
This posting is provided “AS IS” with no warranties, and confers no rights.