Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Client "Host not found"

0 views
Skip to first unread message

lujate

unread,
Mar 14, 2006, 12:15:24 PM3/14/06
to
I am trying to use JDBC to access data on an MS SQL Server from an IBM
iSeries server (aka AS/400). I compiled and ran a sample Java
application from the iSeries, and received the following error:

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.

Joe Weinstein

unread,
Mar 14, 2006, 12:24:10 PM3/14/06
to lujate

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

lujate

unread,
Mar 14, 2006, 12:48:14 PM3/14/06
to
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)

Joe Weinstein

unread,
Mar 14, 2006, 1:29:56 PM3/14/06
to lujate

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();
}
}
}


>

lujate

unread,
Mar 14, 2006, 2:19:23 PM3/14/06
to
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)

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)

Joe Weinstein

unread,
Mar 14, 2006, 4:02:23 PM3/14/06
to lujate
lujate wrote:

> 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

unread,
Mar 14, 2006, 4:10:52 PM3/14/06
to

Joe Weinstein

unread,
Mar 14, 2006, 4:17:15 PM3/14/06
to lujate

lujate wrote:

> "Yes, there is, we got a socket."

Ok, I'm stumped. I hope the MS folks can chip in.
Joe

lujate

unread,
Mar 14, 2006, 4:22:59 PM3/14/06
to
Thank you for all your help.

lujate

unread,
Mar 16, 2006, 11:21:41 AM3/16/06
to
We did not have any DNS servers defined on our iSeries. I did not
think that would cause any problems because I was referencing the SQL
Server via IP address. I added the DNS servers and that fixed the
problem.

Thanks

Duncan Liu

unread,
Jan 11, 2008, 5:10:28 PM1/11/08
to
I got the same error msg as yours.
com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)State:
08S01

Did you get your problem fix? if you did, would you please post 'HOW' you
fix it?

Thanks,

Bunny

url:http://www.ureader.com/msg/1148274.aspx

Evan T. Basalik (MSFT)

unread,
Jan 15, 2008, 4:54:16 PM1/15/08
to
Can you provide us with some more information? Code? Connection string?

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.


0 new messages