Title: RE: ojb and mssql and clob

Hi Frank,

there are many solutions for CLOB and BLOB.
I have a expirience with oracle, but see the
attached emails. This emails are in list.

regards,
Carlos 


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: segunda-feira, 29 de setembro de 2003 12:39
To: [EMAIL PROTECTED]
Subject: ojb and mssql and clob


Hi OJB Users,

We are using a mssql database.
I would like to store a log file in a database table.
What's the best way to handle CLOBS with OJB ?

Thanks for your help,

Frank Renaers

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

 

--- Begin Message ---
Title: Re: OJB + Oracle BLOB

Ok, i'm not using oracle so i can't say if it shouldn't work there. It do
work good for me (except for the memory-usage) with a MySql-database.


Regards
Roland
----- Original Message -----
From: "Carlos Henrique Leclerc De Oliveira" <[EMAIL PROTECTED]>
To: "'OJB Users List'" <[EMAIL PROTECTED]>
Sent: Friday, September 19, 2003 7:17 PM
Subject: RE: OJB + Oracle BLOB


Hi Max, Roland, Matthew, Lance,

first, accepts my thanks about answers!



Roland,
I did try your solution but, sometimes, I get a
null byte[] and sometimes I get a byte array
with size different of BLOB size.
My BLOB has average 2k.


Matthew,
I am new in list and I don�t have the old messages.
I will try to retrieve. Your solution is using:
InputStream is = db.getBinaryStream() ? I would
like to help you to define a 100% solution.


Lance,
I did try your solution, but before the OJB call
the conversion.sqlToJav method, the source object
was null because de rs.getBlob() returned null.



I am using classes12_01.zip Oracle thin driver,
and Oracle 8i.

Thanks a lot!

[]s,
Caique









-----Original Message-----
From: Lance Eason [mailto:[EMAIL PROTECTED]]
Sent: sexta-feira, 19 de setembro de 2003 13:08
To: OJB Users List
Subject: RE: OJB + Oracle BLOB


It's pretty simple unless you're using the Oracle thin driver (more on this
in a second).  In the mapping for the column just declare the column to be
of type 'BLOB' and optionally specify a field conversion:

      <field-descriptor
         name="blobValue"
         column="my_blob_column"
         jdbc-type="BLOB"

conversion="com.whisperwire.platform.db.ojb.ByteArray2BlobFieldConversion"
      />

If you don't specify a field conversion OJB will use the default field
conversion which is going to expect the class' field to be of type
java.sql.Blob.  This works okay under JDBC 3.0 where the Blob interface is
modifiable but requires db specific code for JDBC 2.0 (i.e. jdk 1.3.x)
because you have to be able to create a new instance of the Blob and each
JDCB driver has their own implementation.  We use custom field conversions
to convert the Blob back and forth to what we want, the simplest being just
a byte[]:

public class ByteArray2BlobFieldConversion implements FieldConversion {

/**
* @see
org.apache.ojb.broker.accesslayer.conversions.FieldConversion#javaToSql(java
.lang.Object)
*/
public Object javaToSql(Object source) throws ConversionException {
// source should already be byte[]
return source;
}

/**
* @see
org.apache.ojb.broker.accesslayer.conversions.FieldConversion#sqlToJava(java
.lang.Object)
*/
public Object sqlToJava(Object source) throws ConversionException {
if (source == null) {
return null;
}
try {
if (source instanceof Blob) {
Blob b = (Blob) source;
byte[] bytes = b.getBytes(1, (int)
b.length());
return bytes;
} else {
return source;
}
} catch(SQLException se) {
throw new WrappedRuntimeException(se);
}
}
}

For certain versions of the Oracle thin driver there is a hard limitation
(really annoying Oracle bug) of 4k worth of data that can be updated through
the Blob interface (no corresponding limitation on reading a Blob value).
This is definitely present in the Oracle 8.x thin drivers but I believe it
may be fixed in the Oracle 9.x thin drivers.  If you have this situation let
me know and I'll give you more details on what you have to do to workaround
this.

-----Original Message-----
From: Carlos Henrique Leclerc De Oliveira [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 19, 2003 7:58 AM
To: 'OJB Users List'
Subject: RE: OJB + Oracle BLOB


Thanks Max, but this documentation
didn�t was finished yet...and the
part that describe how to
use, is to be written yet.

Did you already use Oracle BLOB�s
with OJB?

regards,
Carlos

-----Original Message-----
From: Geigl Maximilian, R235 [mailto:[EMAIL PROTECTED]]
Sent: sexta-feira, 19 de setembro de 2003 04:04
To: OJB Users List
Subject: AW: OJB + Oracle BLOB


Hi,

this should help:

http://db.apache.org/ojb/howto-use-lobs.html

Regards
Max

> -----Urspr�ngliche Nachricht-----
> Von: Carlos Henrique Leclerc De Oliveira [mailto:[EMAIL PROTECTED]]
> Gesendet: Donnerstag, 18. September 2003 23:03
> An: 'OJB Users List'
> Betreff: OJB + Oracle BLOB
>
>
> Hi all,
>
> Could you tell me how oracle Blobs
> are loaded and stored, using OJB, please?
>
> There are not documentation...
>
> regards,
> Carlos
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: quinta-feira, 18 de setembro de 2003 16:10
> To: [EMAIL PROTECTED]
> Subject: Xdoclet and transient fields.
>
>
>
>
>
>
> Hello All,
> Why does XDoclet ignore transient references? I have a
> transient collection
> defined that I want to store and I use transient for serialization
> purposes.
> When I use transient keyword xdoclet ignores collection
> completely, but
> when i remove a transient keyword it works fine.
> Any thoughts?
>
> Thanks,
> Roman
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
Title: RE: OJB + Oracle BLOB

check the list and you'll notice that I've done what I believe to be 80% of the solution for BLOBS/CLOBS of ANY size in Oracle. I need someone's help to finish the last few bits.

 
cheers,
Matthew

        -----Original Message-----
        From: Roland Carlsson [mailto:[EMAIL PROTECTED]]
        Sent: Fri 9/19/2003 8:58 AM
        To: OJB Users List
        Cc:
        Subject: Re: OJB + Oracle BLOB
       
       

        Hi Carlos!
       
        I have been working a little with blobs and so far my  solution simply are
        that there are no BLOB/java.sql.Blob mapping working in ojb (please tell me
        that I'm wrong, id be very happy if there are a solution).
       
        The work-around for the problem is to map your BLOB to a byte[] and in the
        repository.xml say it is a LONGVARBINARY. I'm not sure if this works with
        Oracle.
       
        Table has a BLOB.
        Class has a byte[]
        mapping says it is a LONGVARBINARY
       
        The problem with this work-around is that it always load your blob into
        memory witch might be really not desirable. There are work-arounds for that
        problem to... just search the arcives.
       
        Regards
        Roland Carlsson
       
       
        ----- Original Message -----
        From: "Carlos Henrique Leclerc De Oliveira" <[EMAIL PROTECTED]>
        To: "'OJB Users List'" <[EMAIL PROTECTED]>
        Sent: Friday, September 19, 2003 2:58 PM
        Subject: RE: OJB + Oracle BLOB
       
       
        Thanks Max, but this documentation
        didn�t was finished yet...and the
        part that describe how to
        use, is to be written yet.
       
        Did you already use Oracle BLOB�s
        with OJB?
       
        regards,
        Carlos
       
        -----Original Message-----
        From: Geigl Maximilian, R235 [mailto:[EMAIL PROTECTED]]
        Sent: sexta-feira, 19 de setembro de 2003 04:04
        To: OJB Users List
        Subject: AW: OJB + Oracle BLOB
       
       
        Hi,
       
        this should help:
       
        http://db.apache.org/ojb/howto-use-lobs.html
       
        Regards
        Max
       
        > -----Urspr�ngliche Nachricht-----
        > Von: Carlos Henrique Leclerc De Oliveira [mailto:[EMAIL PROTECTED]]
        > Gesendet: Donnerstag, 18. September 2003 23:03
        > An: 'OJB Users List'
        > Betreff: OJB + Oracle BLOB
        >
        >
        > Hi all,
        >
        > Could you tell me how oracle Blobs
        > are loaded and stored, using OJB, please?
        >
        > There are not documentation...
        >
        > regards,
        > Carlos
        >
        > -----Original Message-----
        > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
        > Sent: quinta-feira, 18 de setembro de 2003 16:10
        > To: [EMAIL PROTECTED]
        > Subject: Xdoclet and transient fields.
        >
        >
        >
        >
        >
        >
        > Hello All,
        > Why does XDoclet ignore transient references? I have a
        > transient collection
        > defined that I want to store and I use transient for serialization
        > purposes.
        > When I use transient keyword xdoclet ignores collection
        > completely, but
        > when i remove a transient keyword it works fine.
        > Any thoughts?
        >
        > Thanks,
        > Roman
        >
        >
        >
        > ---------------------------------------------------------------------
        > To unsubscribe, e-mail: [EMAIL PROTECTED]
        > For additional commands, e-mail: [EMAIL PROTECTED]
        >
       
        ---------------------------------------------------------------------
        To unsubscribe, e-mail: [EMAIL PROTECTED]
        For additional commands, e-mail: [EMAIL PROTECTED]
       
       
       
        ---------------------------------------------------------------------
        To unsubscribe, e-mail: [EMAIL PROTECTED]
        For additional commands, e-mail: [EMAIL PROTECTED]
       
       

 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--- End Message ---
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to