java.sql.SQLException: JZ006: Caught IOException: java.io.IOException:
JZ0EM: End of data.
What was quite unnerving is that the Sybase documentation makes no
mention of either of these SQLStates.
What was more unnerving was the actual cause of the problem, once I
discovered it.
I share my experience here in hopes that it may save others some hours
of futile debugging.
The cause of the error was an incorrectly named database column in my
prepared sql statement. Why I didn't get an "unknown column name"
exception confounds me.
I was testing saving and retrieving data. The java class that I wanted
to persist has the following structure:
public class TestTypes extends PersistentObject {
private java.lang.String testString;
private Integer testInteger;
private Short testShort;
private Double testDouble;
private Long testLong;
private Float testFloat;
private Boolean testBoolean;
private java.sql.Date testDate;
private java.sql.Timestamp testTimestamp;
}
The Sybase table, TestTypes, has the following layout:
oid integer
testString varchar 255
testInteger integer
testDate date
testTimestatmp timestamp
testBit bit
testBigint bigint
testSmallint smallint
testDouble double
testFloat float
I created a class to map java class attributes to database columns.
It's used to construct such things as prepared statements, such as
"INSERT INTO <tablename> (<columnnames>) values (<?...>)", retrieving
the column names from a vector of these attribute maps. I inadvertently
set one of the attribute maps' column names to "testBoolean" instead of
"testBit", resulting in the prepared statement "INSERT INTO TestTypes
(oid, testString, testInteger, testDate, testTimestatmp, testBoolean,
testBigint, testSmallint, testDouble, testFloat) values
(?,?,?,?,?,?,?,?,?,?)", instead of "INSERT INTO TestTypes (oid,
testString, testInteger, testDate, testTimestatmp, testBit, testBigint,
testSmallint, testDouble, testFloat) values (?,?,?,?,?,?,?,?,?,?)"
That was the cause of the cryptic exception. As soon as I corrected it,
everything worked fine. Hope this helps someone.
Cheers,
Ed
hope you will help me
abi
sorry my last mail was bit confusing right okay now i tell u in details i am
working in JDBC and in linux there is no ODBC so that i can make a bridge
between my database and my JDBC program has any one of u has any idea how i
can do it and has any of you know about the good driver which i can use it ,
if yes pls mail me back as soon as possible, bye
abi
should i say thank u to all in advance for helping me don't forget to mail
me up guys i need this editor as soon as possible bye
abi