Hi,

the code to fill the clob looks like that:

    Writer outstream = clob.getCharacterOutputStream();

    int i = 0;
    int chunk = 10;

    while (i < length)
    {
      outstream.write(i + "hello world", 0, chunk);

      i += chunk;
      if (length - i < chunk)
        chunk = (int) length - i;
    }
    outstream.close();

The clob is of course a CLOB, as I said.

Naming this function fillClob(int length) and calling fillClob(16000)
works for me, using the thin driver.
The server is 8.1.7 on a Solaris box, but I'm sure it works with the
windows box, too.

Georg

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of
Sacha Labourey
Sent: Monday, May 20, 2002 13:57
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-dev] CMP2.0 and CLOB: same as JAWS


Hello,

> I would post the code here, but I'm not sure whether Oracle's license 
> puts any restriction on publishing their demo code. Basically they use

> their BLOB and CLOB classes and
> getCharacterStream()/getBinaryStream()
> to read the data, and 
> getCharacterOutputStream()/getBinaryOutputStream()
> to write the data.

OK, but their readme file for driver v8.1.7 and v9.0.1 indicates that
calling getCharacterOutputStream (CLOB) will only work with OCI, not
Thin => the only solution is to use setClob passing an instance of
oracle.sql.Clob. Passing a class implementing java.sql.Clob results in a
ClassCastException in Oracle's code...

Calling getCharacterOutputStream and passing the string *will* work with
the THIN driver *only* with small strings (<2k I guess). With bigger
string, it will fail. Are you sure you've succedded your tests with
*big* strings?

But I agree, we will have to put some Oracle (or any other db) specific
code in some cases. BEA WL, for example, has the support (in its
PreparedStatement interface) for setClob *and* setCLOB. This last being
an
*oracle* specific method because it wants an Oracle CLOB object, not a
simple object implementing java.sql.Clob!...

Cheers,



                                Sacha


_______________________________________________________________
Hundreds of nodes, one monster rendering program.
Now that's a super model! Visit http://clustering.foundries.sf.net/

_______________________________________________
Jboss-development mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development


_______________________________________________________________
Hundreds of nodes, one monster rendering program.
Now that's a super model! Visit http://clustering.foundries.sf.net/

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to