You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by "Perlman, Julia" <Ju...@cognos.com> on 2006/10/04 20:54:36 UTC

Calling ResultSet.next() throws SQLException with 'attempted to read more data than was originally stored SQLSTATE: XJ001: Java exception: ': java.io.EOFException'

Hi,

I think I am observing a bug in Derby 10.1.3.1. Could you please let me
know whether it is a known bug? Should I log this bug?

Thank you,
Julia

 A simple JDBC application creates a connection to a Derby database,
prepare and executes the following SELECT and gets SQLException from
ResultSet.next() call while no rows are expected to be returned:

		PreparedStatement pstm = con.prepareStatement(
"select a.CMID from CMOBJNAMES a left outer join CMOBJNAMES i on
upper(a.NAME)=upper(i.NAME) inner join " +
"CMOBJECTS ap on a.CMID=ap.CMID inner join CMOBJECTS ip on
i.CMID=ip.CMID and ap.PCMID=ip.PCMID " +
"where i.CMID != a.CMID and i.CMID in (?,?)");

		pstm.setInt(1,156);
		pstm.setInt(2,157);
		
		ResultSet rs = pstm.executeQuery(); // No rows are
expected in the result set
		boolean bNext = rs.next();  
		pstm.close(); 

If 'i.CMID in (?,?)' part of SELECT is changed to 'i.CMID in (?)'
everything works fine for any of CMID (156 or 157).

The sysinfo and SQLException are details are:
------------------ Java Information ------------------
Java Version:    1.4.2_05
Java Vendor:     Sun Microsystems Inc.
Java home:       C:\Program Files\Java\j2re1.4.2_05
Java classpath:
C:\cm-2\content_manager\tools\JDBCTest;C:\cm-2\content_manager\tools\JDB
CTest\win32\lib\JSQLConnect.jar;C:\cm-2\content_manager\tools\JDBCTest\w
in32\lib\classes12.jar;C:\cm-2\content_manager\tools\JDBCTest\win32\lib\
db2java.jar;C:\cm-2\content_manager\tools\JDBCTest\win32\lib\jconn2.jar;
C:\cm-2\content_manager\tools\JDBCTest\win32\lib\derbyclient.jar;C:\cm-2
\content_manager\tools\JDBCTest\win32\lib\derbytools.jar
OS name:         Windows XP
OS architecture: x86
OS version:      5.1
Java user name:  perlmanj
Java user home:  C:\Documents and Settings\perlmanj
Java user dir:   C:\cm-2\content_manager\tools\JDBCTest
java.specification.name: Java Platform API Specification
java.specification.version: 1.4
--------- Derby Information --------
JRE - JDBC: J2SE 1.4.2 - JDBC 3.0
[C:\cm-2\content_manager\tools\JDBCTest\win32\lib\derbyclient.jar]
10.1.2.1 - (330608)
[C:\cm-2\content_manager\tools\JDBCTest\win32\lib\derbytools.jar]
10.1.3.1 - (417277)
------------------------------------------------------
----------------- Locale Information -----------------
------------------------------------------------------

org.apache.derby.client.am.SqlException: Restore of a serializable or
SQLData object of class , attempted to read more data than was
originally stored SQLSTATE: XJ001: Java exception: ':
java.io.EOFException'.
	at org.apache.derby.client.am.ResultSet.completeSqlca(Unknown
Source)
	at
org.apache.derby.client.net.NetResultSetReply.parseFetchError(Unknown
Source)
	at
org.apache.derby.client.net.NetResultSetReply.parseCNTQRYreply(Unknown
Source)
	at
org.apache.derby.client.net.NetResultSetReply.readFetch(Unknown Source)
	at org.apache.derby.client.net.ResultSetReply.readFetch(Unknown
Source)
	at org.apache.derby.client.net.NetResultSet.readFetch_(Unknown
Source)
	at org.apache.derby.client.am.ResultSet.flowFetch(Unknown
Source)
	at org.apache.derby.client.net.NetCursor.getMoreData_(Unknown
Source)
	at org.apache.derby.client.am.Cursor.next(Unknown Source)
	at org.apache.derby.client.am.ResultSet.nextX(Unknown Source)
	at org.apache.derby.client.am.ResultSet.next(Unknown Source)
	at
test.JSQLConnectTestDriver.runTestDriver(JSQLConnectTestDriver.java:72)
	at
test.JSQLConnectTestDriver.main(JSQLConnectTestDriver.java:34)

DDLs to create tables:

create table CMOBJECTS (
	CMID			integer not null ,
	PCMID			integer not null ,
	VERSION			integer default 1 not null ,
	CREATED			timestamp not null ,
	MODIFIED		timestamp not null ,
	DISABLED		smallint,
	CLASSID			smallint not null,
	DISPSEQ			integer with default 0 not null,
	OWNER			integer, 
	HIDDEN			decimal(1,0),
	constraint PK_CMOBJECTS primary key (CMID),
	constraint PK_CMPARENT unique (PCMID, CMID)
);

create index IDX_CLASS on CMOBJECTS(CLASSID);

create index IDX_PARENT on CMOBJECTS(PCMID);

create index IDX_CREATED on CMOBJECTS(CREATED);

create table CMOBJNAMES (
	CMID			integer			not null,
	LOCALEID		smallint		not null,
	MAPDLOCALEID	smallint,
	ISDEFAULT		decimal(1,0)	not null,
	NAME			varchar(255)	not null,
	constraint		PK_CMOBJNAMES	primary key (CMID,
LOCALEID)
);
 
     This message may contain privileged and/or confidential information.  If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so.  Thank you.

Re: Calling ResultSet.next() throws SQLException with 'attempted to read more data than was originally stored SQLSTATE: XJ001: Java exception: ': java.io.EOFException'

Posted by Rajesh Kartha <ka...@gmail.com>.
Hi,

I tried the steps you mentioned in  your mail, but could not  reproduce 
the issue. What version of Derby are
you using for the server part - 10.1.3.1 ? Also noticed that the 
derbyclient.jar used in your case is  10.1.2.1 - (330608).
I would not expect that to be an issue eitherway.

Any other info/repro that you could share would be useful.. Is it 
possible try your scenario  using v10.2 jars ?
The v10.2 is very close to an official release (voting in progress), 
here is some info on that - http://wiki.apache.org/db-derby/TenTwoRelease

-Rajesh

Perlman, Julia wrote:

> Hi,
>
> I think I am observing a bug in Derby 10.1.3.1. Could you please let 
> me know whether it is a known bug? Should I log this bug?
>
> Thank you,
> Julia
>
>  A simple JDBC application creates a connection to a Derby database, 
> prepare and executes the following SELECT and gets SQLException from 
> ResultSet.next() call while no rows are expected to be returned:
>
>                 PreparedStatement pstm = con.prepareStatement(
> "select a.CMID from CMOBJNAMES a left outer join CMOBJNAMES i on 
> upper(a.NAME)=upper(i.NAME) inner join " +
> "CMOBJECTS ap on a.CMID=ap.CMID inner join CMOBJECTS ip on 
> i.CMID=ip.CMID and ap.PCMID=ip.PCMID " +
> "where i.CMID != a.CMID and i.CMID in (?,?)");
>
>                 pstm.setInt(1,156);
>                 pstm.setInt(2,157);
>                
>                 ResultSet rs = pstm.executeQuery(); // No rows are 
> expected in the result set
>                * boolean* bNext = rs.next(); 
>                 pstm.close();
>
> If 'i.CMID in (?,?)' part of SELECT is changed to 'i.CMID in (?)' 
> everything works fine for any of CMID (156 or 157).
>
> The sysinfo and SQLException are details are:
> ------------------ Java Information ------------------
> Java Version:    1.4.2_05
> Java Vendor:     Sun Microsystems Inc.
> Java home:       C:\Program Files\Java\j2re1.4.2_05
> Java classpath:  
> C:\cm-2\content_manager\tools\JDBCTest;C:\cm-2\content_manager\tools\JDBCTest\win32\lib\JSQLConnect.jar;C:\cm-2\content_manager\tools\JDBCTest\win32\lib\classes12.jar;C:\cm-2\content_manager\tools\JDBCTest\win32\lib\db2java.jar;C:\cm-2\content_manager\tools\JDBCTest\win32\lib\jconn2.jar;C:\cm-2\content_manager\tools\JDBCTest\win32\lib\derbyclient.jar;C:\cm-2\content_manager\tools\JDBCTest\win32\lib\derbytools.jar
>
> OS name:         Windows XP
> OS architecture: x86
> OS version:      5.1
> Java user name:  perlmanj
> Java user home:  C:\Documents and Settings\perlmanj
> Java user dir:   C:\cm-2\content_manager\tools\JDBCTest
> java.specification.name: Java Platform API Specification
> java.specification.version: 1.4
> --------- Derby Information --------
> JRE - JDBC: J2SE 1.4.2 - JDBC 3.0
> [C:\cm-2\content_manager\tools\JDBCTest\win32\lib\derbyclient.jar] 
> 10.1.2.1 - (330608)
> [C:\cm-2\content_manager\tools\JDBCTest\win32\lib\derbytools.jar] 
> 10.1.3.1 - (417277)
> ------------------------------------------------------
> ----------------- Locale Information -----------------
> ------------------------------------------------------
>
> _org.apache.derby.client.am.SqlException_: Restore of a serializable 
> or SQLData object of class , attempted to read more data than was 
> originally stored SQLSTATE: XJ001: Java exception: ': 
> java.io.EOFException'.
>
>         at org.apache.derby.client.am.ResultSet.completeSqlca(Unknown 
> Source)
>         at 
> org.apache.derby.client.net.NetResultSetReply.parseFetchError(Unknown 
> Source)
>         at 
> org.apache.derby.client.net.NetResultSetReply.parseCNTQRYreply(Unknown 
> Source)
>         at 
> org.apache.derby.client.net.NetResultSetReply.readFetch(Unknown Source)
>         at 
> org.apache.derby.client.net.ResultSetReply.readFetch(Unknown Source)
>         at org.apache.derby.client.net.NetResultSet.readFetch_(Unknown 
> Source)
>         at org.apache.derby.client.am.ResultSet.flowFetch(Unknown Source)
>         at org.apache.derby.client.net.NetCursor.getMoreData_(Unknown 
> Source)
>         at org.apache.derby.client.am.Cursor.next(Unknown Source)
>         at org.apache.derby.client.am.ResultSet.nextX(Unknown Source)
>         at org.apache.derby.client.am.ResultSet.next(Unknown Source)
>         at 
> test.JSQLConnectTestDriver.runTestDriver(_JSQLConnectTestDriver.java:72_)
>         at 
> test.JSQLConnectTestDriver.main(_JSQLConnectTestDriver.java:34_)
>
> DDLs to create tables:
>
> create table CMOBJECTS (
>         CMID                    integer not null ,
>         PCMID                   integer not null ,
>         VERSION                 integer default 1 not null ,
>         CREATED                 timestamp not null ,
>         MODIFIED                timestamp not null ,
>         DISABLED                smallint,
>         CLASSID                 smallint not null,
>         DISPSEQ                 integer with default 0 not null,
>         OWNER                   integer,
>         HIDDEN                  decimal(1,0),
>         constraint PK_CMOBJECTS primary key (CMID),
>         constraint PK_CMPARENT unique (PCMID, CMID)
> );
>
> create index IDX_CLASS on CMOBJECTS(CLASSID);
>
> create index IDX_PARENT on CMOBJECTS(PCMID);
>
> create index IDX_CREATED on CMOBJECTS(CREATED);
>
> create table CMOBJNAMES (
>         CMID                    integer                 not null,
>         LOCALEID                smallint                not null,
>         MAPDLOCALEID    smallint,
>         ISDEFAULT               decimal(1,0)    not null,
>         NAME                    varchar(255)    not null,
>         constraint              PK_CMOBJNAMES   primary key (CMID, 
> LOCALEID)
> );
>
>  
>      This message may contain privileged and/or confidential 
> information.  If you have received this e-mail in error or are not the 
> intended recipient, you may not use, copy, disseminate or distribute 
> it; do not open any attachments, delete it immediately from your 
> system and notify the sender promptly by e-mail that you have done 
> so.  Thank you.