Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 77529 invoked from network); 2 Mar 2007 01:24:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Mar 2007 01:24:13 -0000 Received: (qmail 38956 invoked by uid 500); 2 Mar 2007 01:24:21 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 38932 invoked by uid 500); 2 Mar 2007 01:24:21 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 38923 invoked by uid 99); 2 Mar 2007 01:24:21 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Mar 2007 17:24:21 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Mar 2007 17:24:11 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C0A977142D0 for ; Thu, 1 Mar 2007 17:23:50 -0800 (PST) Message-ID: <149733.1172798630759.JavaMail.jira@brutus> Date: Thu, 1 Mar 2007 17:23:50 -0800 (PST) From: "Henri Yandell (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-1368) EOFException when reading from blob's binary stream In-Reply-To: <31038202.1149240689808.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-1368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12477155 ] Henri Yandell commented on DERBY-1368: -------------------------------------- http://jira.opensymphony.com/browse/QUARTZ-560 appears to be a similar problem. An empty blob (I think) goes in and when it comes out it sometimes fires an EOFException. > EOFException when reading from blob's binary stream > --------------------------------------------------- > > Key: DERBY-1368 > URL: https://issues.apache.org/jira/browse/DERBY-1368 > Project: Derby > Issue Type: Bug > Components: JDBC > Affects Versions: 10.1.2.1 > Reporter: Tobias Bocanegra > Attachments: Derby1368.java > > > reading the 'length()' of a blob reads a previously aquired binary stream. > test case: > public static void main(String[] argv) throws Exception { > String driver = "org.apache.derby.jdbc.EmbeddedDriver"; > String url = "jdbc:derby:derby/test;create=true"; > Class.forName(driver); > Connection con = DriverManager.getConnection(url, "sa", ""); > con.setAutoCommit(true); > // create table > System.out.println("1) creating table..."); > Statement stmt = con.createStatement(); > stmt.execute("create table T1 (ID char(32) PRIMARY KEY, DATA blob(2G) not null)"); > stmt.close(); > // add row > System.out.println("2) adding row..."); > byte[] data = new byte[1024*1024*1]; > data[0] = 1; > data[1] = 2; > PreparedStatement s = con.prepareStatement("insert into T1 (ID, DATA) values (?, ?)"); > s.setString(1, "id"); > s.setBytes(2, data); > s.execute(); > s.close(); > // read row > System.out.println("3) reading row..."); > s = con.prepareStatement("select DATA from T1 where ID = ?"); > s.setString(1, "id"); > s.execute(); > ResultSet rs = s.getResultSet(); > rs.next(); > Blob b = rs.getBlob(1); > // test output > System.out.println("4) Length: " + b.length()); > InputStream in = b.getBinaryStream(); > System.out.println(" First Byte: " + in.read()); > in.close(); > in = b.getBinaryStream(); > System.out.println("5) Length: " + b.length()); > System.out.println(" First Byte: " + in.read()); > in.close(); > rs.close(); > s.close(); > con.close(); > } > gives: > 1) creating table... > 2) adding row... > 3) reading row... > 4) Length: 1048576 > First Byte: 1 > 5) Length: 1048576 > First Byte: -1 > imo, 5) is wrong. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.