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.

Jconnect has an internal error???

3 posts in JDBC Connect (product renamed to JConnect) Last posting was on 1997-07-30 20:22:59.0Z
ismael Posted on 1997-07-30 08:37:32.0Z
Message-ID: <33DEFD4C.380A@worldnet.fr>
Date: Wed, 30 Jul 1997 10:37:32 +0200
From: ismael <osiris4@worldnet.fr>
Reply-To: osiris4@worldnet.fr
Organization: SG
X-Mailer: Mozilla 3.01Gold (Win95; I)
MIME-Version: 1.0
Subject: Jconnect has an internal error???
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 187
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:452
Article PK: 252204

hi.

I am trying to evaluate your driver for Sybase, Jconnect, but i have
found some problems.

When i execute a class who use Jconnect with JDB, i have an error who
blocks the application.

I have copied the message generated by the JDB. I would want to know
what is the problem.

The code for Essai.java is:

// Extract version info from the driver, try to connect to the sample
// pubs2 database outside the Sybase corporate firewall.
import java.io.*;
import java.sql.*;
import com.sybase.utils.Debug;
import java.util.*;

public class Essai
{
public static void main(String args[])
{
String url = "jdbc:sybase:Tds:199.199.9.19:11030";
String query = "SELECT * FROM currency";

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", "pipo");
props.put("password", "pipo");
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...");

// attempt to connect
Connection con = DriverManager.getConnection(url, props);
System.out.println("Connected successfully");

// Get the DatabaseMetaData object and display
// some information about the connection
DatabaseMetaData dma = con.getMetaData ();

System.out.println("\nConnected to " + dma.getURL());
System.out.println("Driver " + dma.getDriverName());
System.out.println("Version " +
dma.getDriverVersion());
System.out.println("");


// Create a Statement object so we can submit
// SQL statements to the driver
Statement stmt = con.createStatement ();

// Submit a query, creating a ResultSet object
ResultSet rs = stmt.executeQuery (query);

// Display all columns and rows from the result set
dispResultSet (rs);

// Close the result set
rs.close();

// Close the statement
stmt.close();

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

private static void dispResultSet (ResultSet rs)
throws SQLException
{
int i;

// Get the ResultSetMetaData. This will be used for
// the column headings

ResultSetMetaData rsmd = rs.getMetaData ();

// Get the number of columns in the result set

int numCols = rsmd.getColumnCount ();

// Display column headings

for (i=1; i<=numCols; i++) {
if (i > 1) System.out.print(",");
System.out.print(rsmd.getColumnLabel(i));
}
System.out.println("");

// Display data, fetching until end of the result set

boolean more = rs.next ();
while (more) {

// Loop through each column, getting the
// column data and displaying

for (i=1; i<=numCols; i++) {
if (i > 1) System.out.print(",");
System.out.print(rs.getString(i));
}
System.out.println("");

// Fetch the next result set row

more = rs.next ();
}
}


}

And the output for JDB:



C:\jdk1.1.3\projects>jdb Essai
Initializing jdb...
0xb246e0:class(Essai)
> run
run Essai
running ...
main[1] Using JDBC driver version 2.1
jConnect (TM) for JDBC(TM)/2.1/Evaluation/JDK11/Wed Jul 16 9:19:13 1997
(Unlicenced)
Your CLASSPATH, Java environment, and jdbcConnect drivers are properly
installed

trying to connect to the Sybase sample dataserver --
...
Sybase jConnect ([Internal debugger error: invalid type code:
1126180948]

Fatal exception: java.lang.NullPointerException
java.lang.NullPointerException
at sun.tools.debug.AgentIn.run(AgentIn.java:80)
at java.lang.Thread.run(Thread.java:474)


What i have to do????

Using:

jdk1.1.3
Windows NT 3.51
Solaris 2.5
Sybase


Thanks for all.

Ismael osiris4@worldnet.fr


David Clegg Posted on 1997-07-30 20:22:59.0Z
Message-ID: <33DFA2A3.679153E2@sybase.com>
Date: Wed, 30 Jul 1997 13:22:59 -0700
From: David Clegg <davec@sybase.com>
X-Mailer: Mozilla 3.01 (X11; I; Linux 1.2.13 i586)
MIME-Version: 1.0
To: osiris4@worldnet.fr
Subject: Re: Jconnect has an internal error???
References: <33DEFD4C.380A@worldnet.fr>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 37
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:442
Article PK: 252194

This is a know bug with JavaSoft's JDB (4019347) - it happens whenever
the application writes more than 256 bytes to System.out.

I believe that the System.out message that is causing this is the
"Free Trial" nag message that jConnect prints when it is used for
its first connection in an application. The licenced version of
jConnect does not print this nag message, and thus doesn't hit this
bug.

It was not the intention of the "nag message" to prevent trial
developers from debugging their applications.

I'm making a change in jConnect to work around this JDB bug. jConnect
will break everything it sends to System.out into 255 byte chunks.
This fix should be available for download in a few days.

dave

ismael wrote:
...
> C:\jdk1.1.3\projects>jdb Essai
> Initializing jdb...
> 0xb246e0:class(Essai)
> > run
> run Essai
> running ...
> main[1] Using JDBC driver version 2.1
> jConnect (TM) for JDBC(TM)/2.1/Evaluation/JDK11/Wed Jul 16 9:19:13 1997
> (Unlicenced)
> Your CLASSPATH, Java environment, and jdbcConnect drivers are properly
> installed
>
> trying to connect to the Sybase sample dataserver --
> ...
> Sybase jConnect ([Internal debugger error: invalid type code:
> 1126180948]
>
> Fatal exception: java.lang.NullPointerException
> java.lang.NullPointerException
> at sun.tools.debug.AgentIn.run(AgentIn.java:80)
> at java.lang.Thread.run(Thread.java:474)


Lance Andersen Posted on 1997-07-30 17:25:19.0Z
Message-ID: <33DF78FF.4458@sybase.com>
Date: Wed, 30 Jul 1997 13:25:19 -0400
From: Lance Andersen <lancea@sybase.com>
X-Mailer: Mozilla 3.01Gold (X11; I; SunOS 5.5.1 sun4m)
MIME-Version: 1.0
Subject: Re: Jconnect has an internal error???
References: <33DEFD4C.380A@worldnet.fr>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 248
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:450
Article PK: 252202

Hi!

This is a known bug in the jdb debugger. From the known bugs list
at http://www.javasoft.com/products/jdk/1.1/knownbugs/debugger.html

4019347 When the debugged process prints strings longer than 256 bytes
to System.out the debugger becomes confused, often failing
with "internal debugger error: invalid type code".

I believe that the System.out message is the following "nag" message
which you
see when you first load the "Free Trial" version of the jConnect driver.
Sybase jConnect (TM) for JDBC (TM) 2.1 Development and Unsupported
Version
It is an unsupported product and is not intended for deployment. It
does
not include free technical support. You can purchase technical
support
on an annual or pay-per-issue basis. Discussion Newsgroup is
available
on www.sybase.com. For additional information on services or
run-time
license, please check Sybase website or call 1-800-8-SYBASE or
+1-510-922-3500 outside of the USA and Canada.

Copyright 1997 Sybase, Inc.
All Rights Reserved

Which is clearly > 256 bytes.

The licenced version of jConnect does not print out this nag message,
and does not hit this jdb bug.

It was NOT the intention of the "nag message" to prevent developers
with the free-trial version of the driver from debugging their
applications.

We will look into changes to jConnect so that anything we write to
System.out is chopped into smaller chunks (255) at a time.


Regards,

-Lance

ismael wrote:
>
> hi.
>
> I am trying to evaluate your driver for Sybase, Jconnect, but i have
> found some problems.
>
> When i execute a class who use Jconnect with JDB, i have an error who
> blocks the application.
>
> I have copied the message generated by the JDB. I would want to know
> what is the problem.
>
> The code for Essai.java is:
>
> // Extract version info from the driver, try to connect to the sample
> // pubs2 database outside the Sybase corporate firewall.
> import java.io.*;
> import java.sql.*;
> import com.sybase.utils.Debug;
> import java.util.*;
>
> public class Essai
> {
> public static void main(String args[])
> {
> String url = "jdbc:sybase:Tds:199.199.9.19:11030";
> String query = "SELECT * FROM currency";
>
> 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", "pipo");
> props.put("password", "pipo");
> 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...");
>
> // attempt to connect
> Connection con = DriverManager.getConnection(url, props);
> System.out.println("Connected successfully");
>
> // Get the DatabaseMetaData object and display
> // some information about the connection
> DatabaseMetaData dma = con.getMetaData ();
>
> System.out.println("\nConnected to " + dma.getURL());
> System.out.println("Driver " + dma.getDriverName());
> System.out.println("Version " +
> dma.getDriverVersion());
> System.out.println("");
>
> // Create a Statement object so we can submit
> // SQL statements to the driver
> Statement stmt = con.createStatement ();
>
> // Submit a query, creating a ResultSet object
> ResultSet rs = stmt.executeQuery (query);
>
> // Display all columns and rows from the result set
> dispResultSet (rs);
>
> // Close the result set
> rs.close();
>
> // Close the statement
> stmt.close();
>
> 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)
> {
> 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);
> }
>
> private static void dispResultSet (ResultSet rs)
> throws SQLException
> {
> int i;
>
> // Get the ResultSetMetaData. This will be used for
> // the column headings
>
> ResultSetMetaData rsmd = rs.getMetaData ();
>
> // Get the number of columns in the result set
>
> int numCols = rsmd.getColumnCount ();
>
> // Display column headings
>
> for (i=1; i<=numCols; i++) {
> if (i > 1) System.out.print(",");
> System.out.print(rsmd.getColumnLabel(i));
> }
> System.out.println("");
>
> // Display data, fetching until end of the result set
>
> boolean more = rs.next ();
> while (more) {
>
> // Loop through each column, getting the
> // column data and displaying
>
> for (i=1; i<=numCols; i++) {
> if (i > 1) System.out.print(",");
> System.out.print(rs.getString(i));
> }
> System.out.println("");
>
> // Fetch the next result set row
>
> more = rs.next ();
> }
> }
>
> }
>
> And the output for JDB:
>
> C:\jdk1.1.3\projects>jdb Essai
> Initializing jdb...
> 0xb246e0:class(Essai)
> > run
> run Essai
> running ...
> main[1] Using JDBC driver version 2.1
> jConnect (TM) for JDBC(TM)/2.1/Evaluation/JDK11/Wed Jul 16 9:19:13 1997
> (Unlicenced)
> Your CLASSPATH, Java environment, and jdbcConnect drivers are properly
> installed
>
> trying to connect to the Sybase sample dataserver --
> ...
> Sybase jConnect ([Internal debugger error: invalid type code:
> 1126180948]
>
> Fatal exception: java.lang.NullPointerException
> java.lang.NullPointerException
> at sun.tools.debug.AgentIn.run(AgentIn.java:80)
> at java.lang.Thread.run(Thread.java:474)
>
> What i have to do????
>
> Using:
>
> jdk1.1.3
> Windows NT 3.51
> Solaris 2.5
> Sybase
>
> Thanks for all.
>
> Ismael osiris4@worldnet.fr

--
===============================================================================
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!!!
===============================================================================