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

Reply via email to