Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 9677 invoked from network); 12 Jul 2010 19:57:15 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 12 Jul 2010 19:57:15 -0000 Received: (qmail 14441 invoked by uid 500); 12 Jul 2010 19:57:15 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 14411 invoked by uid 500); 12 Jul 2010 19:57:14 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 14401 invoked by uid 99); 12 Jul 2010 19:57:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jul 2010 19:57:14 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jul 2010 19:57:11 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o6CJunaB010467 for ; Mon, 12 Jul 2010 19:56:50 GMT Message-ID: <9600012.331831278964609481.JavaMail.jira@thor> Date: Mon, 12 Jul 2010 15:56:49 -0400 (EDT) From: "Fay Wang (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Commented: (OPENJPA-1699) Streaming Lob support in DB2 In-Reply-To: <31109379.85721276547712972.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-1699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12887491#action_12887491 ] Fay Wang commented on OPENJPA-1699: ----------------------------------- In the case of very large lob, DB2 JCC driver will automatically use progressive streaming to retrieve the Lob data. With progressiveStreaming, the inputStream retrieved (see red below) must be materialized before the next iteration of call to rs.next(). ResultSet rs = pstmt.executeQuery(...); while (rs.next()) { InputStream is = rs.getBinaryInputStream(1); writeToFile(is); } rs.close(); However, in OpenJPA, we iterate through the whole resultSet and set the InputStream to respective entities: ResultSet rs = pstmt.executeQuery(...); while (rs.next()) { InputStream is = rs.getBinaryInputStream(1); entity.setInputStream(is); } rs.close(); ... Once the entity is returned from OpenJPA, the application will get Lob Closed exception when trying to process the InputStream: writeToFile(entity.getInputStream()); <== Lob is closed Exception The work around is to force fullyMaterializedLobData to true (see below) in the url, so that the DB2 JCC driver will materialize the whole Lob data into memory before returning to the application: > Streaming Lob support in DB2 > ---------------------------- > > Key: OPENJPA-1699 > URL: https://issues.apache.org/jira/browse/OPENJPA-1699 > Project: OpenJPA > Issue Type: New Feature > Components: jdbc > Affects Versions: 2.0.0 > Reporter: Fay Wang > Assignee: Fay Wang > Fix For: 2.1.0 > > > Streaming Lob support in DB2 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.