Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 94988 invoked from network); 5 Oct 2005 20:57:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Oct 2005 20:57:26 -0000 Received: (qmail 46112 invoked by uid 500); 5 Oct 2005 20:56:51 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 45982 invoked by uid 500); 5 Oct 2005 20:56:51 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 45932 invoked by uid 99); 5 Oct 2005 20:56:50 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Oct 2005 13:56:50 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [204.146.167.214] (HELO Boron.MeepZor.Com) (204.146.167.214) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Oct 2005 13:56:53 -0700 Received: from [127.0.0.1] (dmz-firewall [206.199.198.4]) by Boron.MeepZor.Com (8.12.8/8.12.8) with ESMTP id j95Ktii5017556 for ; Wed, 5 Oct 2005 16:56:18 -0400 Message-ID: <43443D7E.6090907@Source-Zone.Org> Date: Wed, 05 Oct 2005 13:54:22 -0700 From: Rajesh Kartha User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Derby Discussion Subject: Re: CLOBs and the Client driver References: <4342312E.600@nuix.com.au> <4342BA4D.3000902@Source-Zone.Org> <4343109A.5080800@nuix.com.au> In-Reply-To: <4343109A.5080800@nuix.com.au> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi Daniel, Please note that the DerbyClient does not support ResultSet.TYPE_SCROLL_SENSITIVE or ResultSet.TYPE_SCROLL_INSENSITIVE if the ResultSet has LOB. For more info see: http://db.apache.org/derby/papers/DerbyClientSpec.html One has to use the ResultSet.TYPE_FORWARD_ONLY to retrieve the LOB. In you example changing the PreparedStatement line to: reparedStatement pstmt=conn.prepareStatement(selectTable,ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); will take care of getting the actual CLOBs. Do post to the list if you come across any issues. -Rajesh Daniel Noll wrote: > Rajesh Kartha wrote: > >> Can you post the way you are retrieving the CLOBs from the ResultSet. > > > > Darn, the idea didn't work. Okay, here's the code we're using, with a > bit of our framework for free. ;-) > > PreparedStatement ps = database.getPreparedStatementCache().get( > "SELECT date, type, point, detailclass, detailparams " + > "FROM HistoryRecord", > ResultSet.TYPE_SCROLL_INSENSITIVE, > ResultSet.CONCUR_READ_ONLY); > ResultSet rs = ps.executeQuery(); > try > { > // Seek directly to the one we want... > rs.absolute(i + 1); > > Date date = rs.getTimestamp("date"); > HistoryRecord.Type type = HistoryRecord.Type > .values()[rs.getShort("type")]; > HistoryRecord.Point point = HistoryRecord.Point > .values()[rs.getShort("point")]; > HistoryDetail detail = (HistoryDetail) > Class.forName(rs.getString("detailclass")).newInstance(); > > // String detailParamString = rs.getString("detailparams"); > String detailParamString = IOUtils.readToString( > rs.getCharacterStream("detailparams")); > > // Now we parse the XML which was found in detailparams, > // using the particular HistoryDetail class we just instantiated. > } > finally > { > rs.close(); > } > > We noticed this problem when the XML parse started failing every > time. On closer investigation, it was always an empty string being > returned from the results. It looks like it doesn't matter whether we > use getString() or getCharacterStream(), the result is always the > same... works with the embedded driver, but not with the client driver. > > I've checked the database at the other end using the embedded driver > and the values do show up there, so it's not corruption of the > database itself. > > In case it affects things, auto-commit has been turned off, and the > table is being created like this: > > CREATE TABLE HistoryRecord ( > date TIMESTAMP NOT NULL, > type SMALLINT NOT NULL, > point SMALLINT NOT NULL, > detailclass VARCHAR(256), > detailparams CLOB(1M) > ) > > ...yes, I realise we gave this no primary key... but that seems to be > how it is. > > Anyone have any ideas? This seems to be a real stumper, but maybe I'm > missing something obvious. > > Daniel >