Return-Path: Delivered-To: apmail-incubator-empire-db-dev-archive@minotaur.apache.org Received: (qmail 20890 invoked from network); 13 Jul 2009 21:19:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Jul 2009 21:19:21 -0000 Received: (qmail 28166 invoked by uid 500); 13 Jul 2009 21:19:31 -0000 Delivered-To: apmail-incubator-empire-db-dev-archive@incubator.apache.org Received: (qmail 28140 invoked by uid 500); 13 Jul 2009 21:19:31 -0000 Mailing-List: contact empire-db-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: empire-db-dev@incubator.apache.org Delivered-To: mailing list empire-db-dev@incubator.apache.org Received: (qmail 28130 invoked by uid 99); 13 Jul 2009 21:19:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jul 2009 21:19:30 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [87.118.96.127] (HELO eknet.org) (87.118.96.127) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jul 2009 21:19:21 +0000 Received: from green.ekch (84-73-61-147.dclient.hispeed.ch [84.73.61.147]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by eknet.org (Postfix) with ESMTP id 06A379D408E for ; Mon, 13 Jul 2009 23:18:58 +0200 (CEST) Date: Mon, 13 Jul 2009 23:18:56 +0200 From: news@eknet.org To: empire-db-dev@incubator.apache.org Subject: error using apache derby and CLOB datatype Message-ID: <20090713211855.GA14317@green.ekch> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="SUOF0GtieIMvvwua" Content-Disposition: inline X-Operating-System: Debian GNU/Linux 5.0.1 (Kernel 2.6.26-1-amd64) X-Message-Flag: Bitte senden Sie mir keine HTML Mails. Danke! Please do not send HTML mails. Thanks! User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Checked: Checked by ClamAV on apache.org --SUOF0GtieIMvvwua Content-Type: text/plain; charset=us-ascii Content-Disposition: inline hi there i was just experimenting with apache derby and found the following situation: one of my columns needs to store really long texts. so what i did with empire-db is this: C_DESCRIPTION = addColumn("description", DataType.CLOB, 1024*1024, false); not being really sure, if this is the desired way to go, it worked with mysql (5.0.27). the same results in a "BadSQLGrammarException" using apache derby 10.4.2.0. the CLOB datatype is translated into this: CREATE TABLE betmarket ( ... description LONGTEXT, ... im really new to apache derby, but having a quick look at their page i could not find the data type "LONGTEXT" in their manual. they have CLOB and LONG VARCHAR as i could see. where LONG VARCHAR goes up to 32700 characters and a CLOB may be up to 2,147,483,647. i will attach a tiny patch which worked in my case, but im not sure if i missed something... kind regards, eike --SUOF0GtieIMvvwua Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="DBDatabaseDriverDerby.java.patch" Index: src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java =================================================================== --- src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java (revision 793701) +++ src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java (working copy) @@ -573,7 +573,11 @@ } break; case CLOB: - sql.append("LONGTEXT"); + if (c.getSize()<32700) + sql.append("LONG VARCHAR"); + else + sql.append("CLOB"); + break; case BLOB: sql.append("BLOB"); --SUOF0GtieIMvvwua--