I'm trying to add code to com.workingdogs.village.Record.java that writes
Clob columns. I'm working on the saveWithInsert method and using the
PreparedStatement object. Following is the snippet of code:

if (val.isClob())
{
    String str = val.asString();
    int rlength = str.length();
    reader = new StringReader(str);
    stmt.setCharacterStream(ps++, reader, rlength);    //ps represents the
current index of the clob column
}
else
{
    val.setPreparedStatementValue (stmt, ps++);
}

I'm getting the error "java.sql.SQLException: Io exception: Connect reset by
peer: socket write error".

I'm guessing I probably have to first insert the row entering an empty
clob...such as in oracle "insert into tableA (clob_col) value
(empty_clob())", and then setup a ResultSet grabbing the clob locator
(rs.getClob(ps)) and then setting up the stream.

The problem is that I need a way to do this that is db independent. Any
ideas?

On another note, I'm doing this in the saveWithUpdate() method also; I don't
get an exception, but the clob field is empty...



Jack Harris
University of Utah
System Developer



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

Reply via email to