db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <Fisc...@seitenbau.net>
Subject RE: CLOB vs BLOB
Date Fri, 27 Aug 2004 08:30:29 GMT




Hi Sarav

As I understand it, a BLOB is a binary large object, and a CLOB is a
character large object. The difference between characters and bytes is the
Character set, i.e. the mapping between a character and the byte sequence
it represents.
- With a blob, you have to use the right character set to retrive the data,
e.g. if someone writes a text into a BLOB using UTF-8 and you read it back
using ISO-8859-1, you do not get the same string back out.
- With a CLOB, the database takes care of the character set, you supply a
String, and you get a String back, and you do not have to worry about which
bytes are used to represent the characters. in fact, you do not have access
to the byte represetnation, so its uselessi if you want to store bytes.

So in any other database, if you want to store large text, use a CLOB, if
you want to store an image, use a BLOB.

Having said this, it seems to me (although I did not research it) that the
Oracle drivers specify a default character set even for BLOBs, the method
oracle.sql.BLOB.characterStreamValue() seems to do this(I never used it).
So a Oracle BLOB can also be used with CLOB functionality. Looking at the
jdbc specification, this seems to be a oracle-specific extension. It seems
tom me that it is only a oracle-specific _jdbc_ extension. E.g. you cannot
display a BLOB on console, whereas you can display a CLOB.

So the short answer is, if you only use an oracle database and only use
oracle jdbc, you can also use  BLOBs for text. If you want other access
(e.g. sqlplus(console)) access to the text you stored, use a CLOB.
I would consider it cleaner if one would always use a CLOB for text (Rather
rely on standards as opposed to vendor-specific extensions)

  Thomas



"Saravana Krishnan Kannan" <saravkrish@uky.edu> schrieb am 26.08.2004
20:48:42:

> Hi,
>
>   This might be a bit off Topic but here goes...
>
>   I don't see the need for a CLOB type in a Database (to be more
> specific - Oracle) when there is support for a BLOB type. Any CLOB
> can be stored as a BLOB, so what is the need for a CLOB? I agree
> that any other type too can be stored in a BLOB, but I also
> understant they have other features that are not present in a BLOB
> and they are faster than a BLOB (BLOB is a pointer, but primitive
> types are directly stored). Thus it makes sense having primitive data
types.
>
>   I don't see any feature in a CLOB that is not present in a BLOB.
> Obviously I'm missing something - can someone point out what I'm missing?
>
> Thanks,
> Sarav
>
>
> -----Original Message-----
> From: Axel Seinsche <torque@seinsche.net>
> To: "Apache Torque Users List" <torque-user@db.apache.org>
> Date: Thu, 26 Aug 2004 17:21:42 +0200 (CEST)
> Subject: setting sequence start value in schema-xml file
>
> Hi all,
>
> is it possible to set a start value (and increment step) in the
> schema xml file? I didn't find anything when looking through the DTD
> for the id-method-parameter tag. But maybe someone already did that
> and can give me a short hint.
>
> Thank you.
>
> Axel
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message