Title: 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\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.

Reply via email to