You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@empire-db.apache.org by ne...@eknet.org on 2009/07/13 23:18:56 UTC

error using apache derby and CLOB datatype

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

Re: error using apache derby and CLOB datatype

Posted by ne...@eknet.org.
Hi Francis

thanks for  the fast (!) fix.  i agree that most  people (including me
:)) would expect a CLOB when specifying this type. maybe it's a better
idea to use a long varchar on DataType.TEXT if the size is appropriate
for this.

As I said, I'm new to Derby, but I would always expect better
performance on using a (long)-varchar than a clob for any db until i'm
told the opposite...

regards
eike

On [Tue, 14.07.2009 00:06], Francis De Brabandere wrote:
> Hi Eike,
> 
> Thanks for reporting the bug, I added it to Jira for reference.
> https://issues.apache.org/jira/browse/EMPIREDB-44
> 
> I have to admit that the postgres, h2 and derby drivers were only
> tested using our demo application. We need to work on a decent test
> suite. I applied a slightly different patch only using CLOB with size
> as I think most people will expect a CLOB column for the CLOB data
> type (do you think there might be performace implications?)
> 
> I started a build on hudson, it will be deployed on the apache
> snapshot maven repo in a few minutes:
> repository: https://repository.apache.org/content/repositories/snapshots
> 
> Cheers,
> 
> Francis
> 
> On Mon, Jul 13, 2009 at 11:18 PM, <ne...@eknet.org> wrote:
> >
> > 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
> >
> 
> 
> 
> -- 
> http://www.somatik.be
> Microsoft gives you windows, Linux gives you the whole house.
> 

-- 
email: eike@eknet.org   https://www.eknet.org  pgp: 481161A0

Re: error using apache derby and CLOB datatype

Posted by Francis De Brabandere <fr...@gmail.com>.
Hi Eike,

Thanks for reporting the bug, I added it to Jira for reference.
https://issues.apache.org/jira/browse/EMPIREDB-44

I have to admit that the postgres, h2 and derby drivers were only
tested using our demo application. We need to work on a decent test
suite. I applied a slightly different patch only using CLOB with size
as I think most people will expect a CLOB column for the CLOB data
type (do you think there might be performace implications?)

I started a build on hudson, it will be deployed on the apache
snapshot maven repo in a few minutes:
repository: https://repository.apache.org/content/repositories/snapshots

Cheers,

Francis

On Mon, Jul 13, 2009 at 11:18 PM, <ne...@eknet.org> wrote:
>
> 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
>



-- 
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.