Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Cannot use jconnect with JDK 1.0.2

2 posts in JDBC Connect (product renamed to JConnect) Last posting was on 1997-07-23 20:21:38.0Z
Alan Gordon Posted on 1997-07-23 19:25:24.0Z
Message-ID: <33D65AA4.601B@logicon.com>
Date: Wed, 23 Jul 1997 12:25:24 -0700
From: Alan Gordon <agordon@logicon.com>
X-Mailer: Mozilla 3.02Gold (WinNT; I)
MIME-Version: 1.0
Subject: Cannot use jconnect with JDK 1.0.2
Content-Type: multipart/mixed; boundary="------------70FA727A49EF"
Newsgroups: sybase.public.jdbcconnect
Lines: 293
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:473
Article PK: 252225

Hello,

I downloaded the evaluation version of JConnect from your website a few
days ago. I ran a simple validation program ( see the enclosed file
called Validate.jav)a it worked fine as long as I was using JDK 1.1
(actually 1.1.3) and your httpd proxy. When I tried the same thing with
JDK 1.02 (See the enclosed file called Validate2.java) I could not get
it to work. Note that I did change the imports to use 1.0.2 as directed
and I did change my CLASSPATH to use the 1.02 libraries when I'm using
the 1.02 version. When the 1.02 fails I get the following error:

Unexpected exception: JZ0I4

This error often indicates that the database you are trying to connect
to is not up. Try to verify (use a non-jdbc tool) that
jdbc:sybase:Tds:137.51.106.114:8008 is running.

jdbc.sql.SQLException: An IO exception was caught from a lower layer and
rethrown.: java.io.IOException: connection failed to
'137.51.106.114:8008'
at jdbc.sybase.jdbc.ErrorMessage.raiseError(ErrorMessage.java:291)

The problem is actually not that the database is not up, I can run
Validate and Validate2 back-to-back. Validate (the 1.1 JDK version) runs
like a champ. Validate2 (the 1.02 JDK version) will not work. In fact,
in addition to the message above, it crashes the Java interpreter.


Alan

P.S. I'm running on Windows NT 4.0 with Service Pack 3.
CLASSPATH for 1.02 version:
.;c:\jdk1.0.2\classes.zip;c:\jconnect\syb102.zip

CLASSPATH for 1.1 version:
.;c:\jdk1.1.3\classes.zip;c:\jconnect\classes

import java.io.*;
import java.sql.*;
import com.sybase.utils.Debug;
import java.util.*;

public class Validate
{
public static void main(String args[])
{
// String url = "jdbc:sybase:Tds:192.1.2.2:3270";
String url = "jdbc:sybase:Tds:137.51.106.114:8008";
String proxy = "localhost:8000";
boolean tryingProxy = false;
try
{
Class.forName("com.sybase.jdbc.SybDriver");
Driver driver = DriverManager.getDriver(url);
int major = driver.getMajorVersion();
int minor = driver.getMinorVersion();
System.out.println("Using JDBC driver version " +
major + "." + minor);
Properties props = new Properties();
props.put("user", "adans");
props.put("password", "camps1");
DriverPropertyInfo dpi[] = driver.getPropertyInfo(url, props);
// get the version string
for (int i = 0; i < dpi.length; i++)
{
if (dpi[i].name.equals("VERSIONSTRING"))
{
System.out.println(dpi[i].value);
break;
}
}
System.out.println("Your CLASSPATH, Java environment, and " +
"jdbcConnect drivers are properly installed\n\ttrying to " +
"connect to the Sybase sample dataserver --\n\t...this will fail " +
"if your machine is not connected to the internet.");
// Timeouts cause Win95 to hang - some problem with the
// jConnect driver's use of threads to implement timouts...
// DriverManager.setLoginTimeout(10);

// attempt to connect to the sample database
Connection con = DriverManager.getConnection(url, props);
System.out.println("Connected successfully");
con.close();
}
catch (SQLException sqe)
{
String sqlstate = sqe.getSQLState();
String message = sqe.toString();
System.out.println("Unexpected exception: " + sqlstate);
if (sqlstate.equals("JZ0I4"))
{
if (message.indexOf("502") > 0)
{
System.out.println("\nThis error usually indicates that " +
"your HTTP gateway was unable to reach the database " +
"that you specified.\n\n One source of this problem may " +
"be that you are running the httpd/gateway under a " +
"JDK1.0.2 level VM. 1.0.2 has a bug where if you try " +
"to connect to an IP Address which your operation system " +
"does not have a 'name' for (gethostbyname fails?) " +
"then it cannot open a socket to it. This problem is " +
"fixed in JDK1.1 - if you kill your httpd gateway and " +
"restart it under JDK1.1 this problem may be resolved.");
}

else if (message.indexOf("Connection failed to") > 0)
{
if (tryingProxy)
{
System.out.println("\nThis error usually indicates that " +
"your HTTP gateway is NOT running. " +
"Check to see that " + proxy + " is responding.");
}
else
{
System.out.println("\nThis error often indicates that " +
"the database you are trying to connect to is not up. " +
"Try to verify (use a non-jdbc tool) that " + url +
" is running.");
}
}

}
sqe.printStackTrace();
System.exit(1);
}
catch (Throwable e)
{
System.out.println("Unexpected exception : " + e.toString());
if (e instanceof ClassNotFoundException)
{
System.out.println("\nThis error usually indicates that " +
"your Java CLASSPATH environment has not been " +
"set properly.");
}
if (e instanceof NoClassDefFoundError)
{
System.out.println("\nThis error may indicate there " +
"is a version incompatibility among the classes " +
"listed in your CLASSPATH.");
}
e.printStackTrace();
System.exit(1);
}
System.exit(0);
}
}

import java.io.*;
import jdbc.math.*;
import jdbc.sql.*;
import jdbc.sybase.utils.Debug;
import java.util.*;

public class Validate2
{
public static void main(String args[])
{
// String url = "jdbc:sybase:Tds:192.1.2.2:3270";
String url = "jdbc:sybase:Tds:137.51.106.114:8008";
String proxy = "localhost:8000";
boolean tryingProxy = false;
try
{
Class.forName("jdbc.sybase.jdbc.SybDriver");
Driver driver = DriverManager.getDriver(url);
int major = driver.getMajorVersion();
int minor = driver.getMinorVersion();
System.out.println("Using JDBC driver version " +
major + "." + minor);
Properties props = new Properties();
props.put("user", "adans");
props.put("password", "camps1");
DriverPropertyInfo dpi[] = driver.getPropertyInfo(url, props);
// get the version string
for (int i = 0; i < dpi.length; i++)
{
if (dpi[i].name.equals("VERSIONSTRING"))
{
System.out.println(dpi[i].value);
break;
}
}
System.out.println("Your CLASSPATH, Java environment, and " +
"jdbcConnect drivers are properly installed\n\ttrying to " +
"connect to the Sybase sample dataserver --\n\t...this will fail " +
"if your machine is not connected to the internet.");
// Timeouts cause Win95 to hang - some problem with the
// jConnect driver's use of threads to implement timouts...
// DriverManager.setLoginTimeout(10);

// attempt to connect to the sample database
Connection con = DriverManager.getConnection(url, props);
System.out.println("Connected successfully");
con.close();
}
catch (SQLException sqe)
{
String sqlstate = sqe.getSQLState();
String message = sqe.toString();
System.out.println("Unexpected exception: " + sqlstate);
if (sqlstate.equals("JZ0I4"))
{
if (message.indexOf("502") > 0)
{
System.out.println("\nThis error usually indicates that " +
"your HTTP gateway was unable to reach the database " +
"that you specified.\n\n One source of this problem may " +
"be that you are running the httpd/gateway under a " +
"JDK1.0.2 level VM. 1.0.2 has a bug where if you try " +
"to connect to an IP Address which your operation system " +
"does not have a 'name' for (gethostbyname fails?) " +
"then it cannot open a socket to it. This problem is " +
"fixed in JDK1.1 - if you kill your httpd gateway and " +
"restart it under JDK1.1 this problem may be resolved.");
}
else if (message.indexOf("Connection failed to") > 0)
{
if (tryingProxy)
{
System.out.println("\nThis error usually indicates that " +
"your HTTP gateway is NOT running. " +
"Check to see that " + proxy + " is responding.");
}
else
{
System.out.println("\nThis error often indicates that " +
"the database you are trying to connect to is not up. " +
"Try to verify (use a non-jdbc tool) that " + url +
" is running.");
}
}
}
sqe.printStackTrace();
System.exit(1);
}
catch (Throwable e)
{
System.out.println("Unexpected exception : " + e.toString());
if (e instanceof ClassNotFoundException)
{
System.out.println("\nThis error usually indicates that " +
"your Java CLASSPATH environment has not been " +
"set properly.");
}
if (e instanceof NoClassDefFoundError)
{
System.out.println("\nThis error may indicate there " +
"is a version incompatibility among the classes " +
"listed in your CLASSPATH.");
}
e.printStackTrace();
System.exit(1);
}
System.exit(0);
}
}


Lance Andersen Posted on 1997-07-23 20:21:38.0Z
Message-ID: <33D667D2.2677@sybase.com>
Date: Wed, 23 Jul 1997 16:21:38 -0400
From: Lance Andersen <lancea@sybase.com>
X-Mailer: Mozilla 3.01Gold (X11; I; SunOS 5.5.1 sun4m)
MIME-Version: 1.0
To: Alan Gordon <agordon@logicon.com>
Subject: Re: Cannot use jconnect with JDK 1.0.2
References: <33D65AA4.601B@logicon.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 314
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:472
Article PK: 252224

Alan,

Please use a CLASSPATH of

%JDBC_HOME\classes;%JAVA_HOME%\lib\classes.zip;.

The jConnect classes should be 1st in your CLASSPATH and using
the classes directory gives you access to both drivers.

I have converted Validate in the past to run under
jdk102 without problems.

Alan Gordon wrote:
>
> Hello,
>
> I downloaded the evaluation version of JConnect from your website a few
> days ago. I ran a simple validation program ( see the enclosed file
> called Validate.jav)a it worked fine as long as I was using JDK 1.1
> (actually 1.1.3) and your httpd proxy. When I tried the same thing with
> JDK 1.02 (See the enclosed file called Validate2.java) I could not get
> it to work. Note that I did change the imports to use 1.0.2 as directed
> and I did change my CLASSPATH to use the 1.02 libraries when I'm using
> the 1.02 version. When the 1.02 fails I get the following error:
>
> Unexpected exception: JZ0I4
>
> This error often indicates that the database you are trying to connect
> to is not up. Try to verify (use a non-jdbc tool) that
> jdbc:sybase:Tds:137.51.106.114:8008 is running.
>
> jdbc.sql.SQLException: An IO exception was caught from a lower layer and
> rethrown.: java.io.IOException: connection failed to
> '137.51.106.114:8008'
> at jdbc.sybase.jdbc.ErrorMessage.raiseError(ErrorMessage.java:291)
>
> The problem is actually not that the database is not up, I can run
> Validate and Validate2 back-to-back. Validate (the 1.1 JDK version) runs
> like a champ. Validate2 (the 1.02 JDK version) will not work. In fact,
> in addition to the message above, it crashes the Java interpreter.
>
> Alan
>
> P.S. I'm running on Windows NT 4.0 with Service Pack 3.
> CLASSPATH for 1.02 version:
> .;c:\jdk1.0.2\classes.zip;c:\jconnect\syb102.zip
>
> CLASSPATH for 1.1 version:
> .;c:\jdk1.1.3\classes.zip;c:\jconnect\classes
>
> ---------------------------------------------------------------
> import java.io.*;
> import java.sql.*;
> import com.sybase.utils.Debug;
> import java.util.*;
>
> public class Validate
> {
> public static void main(String args[])
> {
> // String url = "jdbc:sybase:Tds:192.1.2.2:3270";
> String url = "jdbc:sybase:Tds:137.51.106.114:8008";
> String proxy = "localhost:8000";
> boolean tryingProxy = false;
> try
> {
> Class.forName("com.sybase.jdbc.SybDriver");
> Driver driver = DriverManager.getDriver(url);
> int major = driver.getMajorVersion();
> int minor = driver.getMinorVersion();
> System.out.println("Using JDBC driver version " +
> major + "." + minor);
> Properties props = new Properties();
> props.put("user", "adans");
> props.put("password", "camps1");
> DriverPropertyInfo dpi[] = driver.getPropertyInfo(url, props);
> // get the version string
> for (int i = 0; i < dpi.length; i++)
> {
> if (dpi[i].name.equals("VERSIONSTRING"))
> {
> System.out.println(dpi[i].value);
> break;
> }
> }
> System.out.println("Your CLASSPATH, Java environment, and " +
> "jdbcConnect drivers are properly installed\n\ttrying to " +
> "connect to the Sybase sample dataserver --\n\t...this will fail " +
> "if your machine is not connected to the internet.");
> // Timeouts cause Win95 to hang - some problem with the
> // jConnect driver's use of threads to implement timouts...
> // DriverManager.setLoginTimeout(10);
>
> // attempt to connect to the sample database
> Connection con = DriverManager.getConnection(url, props);
> System.out.println("Connected successfully");
> con.close();
> }
> catch (SQLException sqe)
> {
> String sqlstate = sqe.getSQLState();
> String message = sqe.toString();
> System.out.println("Unexpected exception: " + sqlstate);
> if (sqlstate.equals("JZ0I4"))
> {
> if (message.indexOf("502") > 0)
> {
> System.out.println("\nThis error usually indicates that " +
> "your HTTP gateway was unable to reach the database " +
> "that you specified.\n\n One source of this problem may " +
> "be that you are running the httpd/gateway under a " +
> "JDK1.0.2 level VM. 1.0.2 has a bug where if you try " +
> "to connect to an IP Address which your operation system " +
> "does not have a 'name' for (gethostbyname fails?) " +
> "then it cannot open a socket to it. This problem is " +
> "fixed in JDK1.1 - if you kill your httpd gateway and " +
> "restart it under JDK1.1 this problem may be resolved.");
> }
>
> else if (message.indexOf("Connection failed to") > 0)
> {
> if (tryingProxy)
> {
> System.out.println("\nThis error usually indicates that " +
> "your HTTP gateway is NOT running. " +
> "Check to see that " + proxy + " is responding.");
> }
> else
> {
> System.out.println("\nThis error often indicates that " +
> "the database you are trying to connect to is not up. " +
> "Try to verify (use a non-jdbc tool) that " + url +
> " is running.");
> }
> }
>
> }
> sqe.printStackTrace();
> System.exit(1);
> }
> catch (Throwable e)
> {
> System.out.println("Unexpected exception : " + e.toString());
> if (e instanceof ClassNotFoundException)
> {
> System.out.println("\nThis error usually indicates that " +
> "your Java CLASSPATH environment has not been " +
> "set properly.");
> }
> if (e instanceof NoClassDefFoundError)
> {
> System.out.println("\nThis error may indicate there " +
> "is a version incompatibility among the classes " +
> "listed in your CLASSPATH.");
> }
> e.printStackTrace();
> System.exit(1);
> }
> System.exit(0);
> }
> }
>
> ---------------------------------------------------------------
> import java.io.*;
> import jdbc.math.*;
> import jdbc.sql.*;
> import jdbc.sybase.utils.Debug;
> import java.util.*;
>
> public class Validate2
> {
> public static void main(String args[])
> {
> // String url = "jdbc:sybase:Tds:192.1.2.2:3270";
> String url = "jdbc:sybase:Tds:137.51.106.114:8008";
> String proxy = "localhost:8000";
> boolean tryingProxy = false;
> try
> {
> Class.forName("jdbc.sybase.jdbc.SybDriver");
> Driver driver = DriverManager.getDriver(url);
> int major = driver.getMajorVersion();
> int minor = driver.getMinorVersion();
> System.out.println("Using JDBC driver version " +
> major + "." + minor);
> Properties props = new Properties();
> props.put("user", "adans");
> props.put("password", "camps1");
> DriverPropertyInfo dpi[] = driver.getPropertyInfo(url, props);
> // get the version string
> for (int i = 0; i < dpi.length; i++)
> {
> if (dpi[i].name.equals("VERSIONSTRING"))
> {
> System.out.println(dpi[i].value);
> break;
> }
> }
> System.out.println("Your CLASSPATH, Java environment, and " +
> "jdbcConnect drivers are properly installed\n\ttrying to " +
> "connect to the Sybase sample dataserver --\n\t...this will fail " +
> "if your machine is not connected to the internet.");
> // Timeouts cause Win95 to hang - some problem with the
> // jConnect driver's use of threads to implement timouts...
> // DriverManager.setLoginTimeout(10);
>
> // attempt to connect to the sample database
> Connection con = DriverManager.getConnection(url, props);
> System.out.println("Connected successfully");
> con.close();
> }
> catch (SQLException sqe)
> {
> String sqlstate = sqe.getSQLState();
> String message = sqe.toString();
> System.out.println("Unexpected exception: " + sqlstate);
> if (sqlstate.equals("JZ0I4"))
> {
> if (message.indexOf("502") > 0)
> {
> System.out.println("\nThis error usually indicates that " +
> "your HTTP gateway was unable to reach the database " +
> "that you specified.\n\n One source of this problem may " +
> "be that you are running the httpd/gateway under a " +
> "JDK1.0.2 level VM. 1.0.2 has a bug where if you try " +
> "to connect to an IP Address which your operation system " +
> "does not have a 'name' for (gethostbyname fails?) " +
> "then it cannot open a socket to it. This problem is " +
> "fixed in JDK1.1 - if you kill your httpd gateway and " +
> "restart it under JDK1.1 this problem may be resolved.");
> }
> else if (message.indexOf("Connection failed to") > 0)
> {
> if (tryingProxy)
> {
> System.out.println("\nThis error usually indicates that " +
> "your HTTP gateway is NOT running. " +
> "Check to see that " + proxy + " is responding.");
> }
> else
> {
> System.out.println("\nThis error often indicates that " +
> "the database you are trying to connect to is not up. " +
> "Try to verify (use a non-jdbc tool) that " + url +
> " is running.");
> }
> }
> }
> sqe.printStackTrace();
> System.exit(1);
> }
> catch (Throwable e)
> {
> System.out.println("Unexpected exception : " + e.toString());
> if (e instanceof ClassNotFoundException)
> {
> System.out.println("\nThis error usually indicates that " +
> "your Java CLASSPATH environment has not been " +
> "set properly.");
> }
> if (e instanceof NoClassDefFoundError)
> {
> System.out.println("\nThis error may indicate there " +
> "is a version incompatibility among the classes " +
> "listed in your CLASSPATH.");
> }
> e.printStackTrace();
> System.exit(1);
> }
> System.exit(0);
> }
> }

--
===============================================================================
Lance J. Andersen Email: lancea@sybase.com
Sybase Technical Support Phone:(617) 564-6336
77 South Bedford Street Fax: (617) 564-6148
Burlington, MA 01803

The Dark Knight Returns!!! Let's Go Penguins!!!
===============================================================================