Radek Terber wrote on 18.09.2006 14:09:
I need insert large text (over 100 KB) into column type CLOB (created as
max. available size - cca 2GB) using SQL command, but derby (latest
release) inserts only cca 32 KB. If text is larger, derby throws SQL
exception with description 'A string constant starting with ''inserted
text ... &' is too long'.
Is it a derby bug, or I do enything wrong ?
I am new in derby.
When dealing with CLOB columns I always use the setCharacterStream() method to
supply the values:
String clobContent = whatever...
stmt = con.prepareStatement("INSERT INTO clob_table (id, clob_col) VALUES
(?,?)";
stmt.setInt(1, 42);
Reader r = new StringReader(clobContent);
stmt.setCharacterStream(2, r, clobContent.length());
stmt.executeUpdate();
con.commit();
This works fine accross most of the JDBC drivers I came across so far including
Derby.
Hope this helps
Thomas