Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Problems with CLOB in JDBC
Hello
I am trying to store a long string in a CLOB using JDBC.
Here is my code:
PreparedStatement ps = connection.prepareStatement("insert into Tester (a)
VALUES (?)");
oracle.sql.CLOB clob = oracle.sql.CLOB.createTemporary(connection, true,
oracle.sql.CLOB.DURATION_SESSION);
Writer writer = clob.getCharacterOutputStream();
try {
writer.write(myString);
writer.close();
}
catch (IOException e) {
throw new RethrownExceptionAsRuntimeException(e);
}
ps.setClob(1, clob);
ps.executeUpdate();
This works well with very long strings :-) But if I try to insert a special char (like the EURO or any other non ascii unicode char) I get the exception below.
Is there a workaorund or another way to store long strings (>5000 chars) in a CLOB?
Tobias
java.sql.SQLException: No more data to read from socket
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:1160) at oracle.jdbc.ttc7.MAREngine.unmarshalUB1(MAREngine.java:963) at oracle.jdbc.ttc7.MAREngine.unmarshalSB1(MAREngine.java:893) at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:369) at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891) at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at Tester.main(Tester.java:38) Received on Thu Jan 30 2003 - 07:14:01 CST
![]() |
![]() |