Menu

Write a CLOB to Oracle DB

Steven
2004-11-11
2013-04-11
  • Steven

    Steven - 2004-11-11

    Hi,

    I'm attempting to write a clob to oracle using a TypeHandler as below:

    public void setParameter(ParameterSetter setter, Object parameter) throws SQLException {
    Reader bodyReader = null;
    try {
    bodyReader = new StringReader(parameter.toString());
    setter.setCharacterStream(bodyReader,parameter.toString().length());
    } catch (Exception e) {
    e.printStackTrace();
    throw new SQLException("Failed to set text field.");
    }

    }

    This appears to work fine for small texts but once I get a large text (more then 4000 chars) then it fails. Actually nothing gets set and I get a null in the clob field in the database. Has anyone managed to solve this problem of writing clobs to an oracle database.

    Cheers,
    Steve.

     
    • Steven

      Steven - 2004-11-11

      Yer well figured it out .. kind of.

      The problem lies with the Oracle thin driver.  If I change to the oci driver everything works fine.  I will use this in the mean time until I find out how to get the thin driver working with clobs.

      Steve.

       

Log in to post a comment.