we actually did encounter this 4K problem when we were using toplink 2.7.x
and there was no elegant solution (sol. suggested by toplink was ugly).
so at the end we implemented our own solution, which is breaking down the CLOB
every 4K, save the clob together with an additional sequence number in the
table.  however i dont think this is an elegant solution either.
and for the way suggested by oracle readme, we didnt try beacuse there are too
many hazard(for a start, we will need to obtain a connection, which we didnt
have - handled by toplink).  maybe this time we will try the oracle way.



regards,

dave
----- Original Message -----
From: "Markus Kling" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 09, 2002 03:35
Subject: Re: [castor-dev] JDO: infamous Oracle 4K limit for CLOB


> There is a limitation regarding the use of stream input for LOB types.
> Stream input for LOB types can only be used for 8.1.7 JDBC OCI driver
> connecting to an 8.1.7 Oracle server. The use of stream input for LOB types
> in all other configurations may result in data corruption. PreparedStatement
> stream input APIs include: setBinaryStream(), setAsciiStream(),
> setUnicodeStream(), setCharacterStream() and setObject(). [from Oracle JDBC
> Driver README].
>
> If you want to use LOBs with the thin driver you have to execute the
> following code (this is described in the oracle jdbc developers guide).
>
> Connection con = ..... con.setAutoCommit(false); // <- required!
>
> // initialize LOB reference
> con.createStatement().executeUpdate("insert into a values
> (empty_blob(), 1)");
>
> // acquire write lock
> ResultSet rs = con.createStatement().executeQuery("select b from a
> where id = 1 for update");
>
> rs.next();
> // get lob reference from write lock
> oracle.sql.BLOB blob =
> ((oracle.jdbc.driver.OracleResultSet)rs).getBLOB(1);
>
> // create statement for update
> PreparedStatement ps = con.prepareStatement("update a set b = ?
> where id = 1");
>
> // stream data into lob
> java.io.OutputStream os = ((oracle.sql.BLOB)
> blob).getBinaryOutputStream();
>
> os.write(readData());
> os.close();
>
> // execute update
> ((oracle.jdbc.driver.OraclePreparedStatement)ps).setBLOB(1, blob);
> ps.executeUpdate();
>
> // close lock
> rs.close();
>
>
> I tried nearly all other possible combinations of databases & drivers (from
> 8.1.5 to 9i) to find a combination that works ..... no way, I just suffered
> headaches %-)
>
> -Markus
>
> -----Urspr�ngliche Nachricht-----
> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Gesendet: Montag, 8. April 2002 11:50
> An: [EMAIL PROTECTED]
> Betreff: Re: [castor-dev] JDO: infamous Oracle 4K limit for CLOB
>
>
> Bruce wrote:
> >I've used CLOBs with Oracle just fine. You must use the OCI driver
> >instead of the thin driver.
>
> Problem is OCI driver + Linux doesn't work.
>
> Getting Castor and thin driver working together, should still be a priority.
>
> Regards
> Jan H. Hansen
>
> ----------------------------------------------------------- If you wish to
> unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a
> subject of: unsubscribe castor-dev
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>


_______________________
CONFIDENTIALITY NOTICE:

This message, together with any attachment, is intended only for the use of the 
individual or entity to whom it is addressed and contains information that is 
privileged and confidential.  If you are not the intended recipient, please be 
informed that any dissemination, distribution or reproduction of this message 
(including any attachment) is strictly prohibited.  If you have received this message 
in error, please notify us immediately by return e-mail and delete the original 
message.  Thank you.

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to