db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Kellerer <spam_ea...@gmx.net>
Subject Re: Insert large using SQL
Date Mon, 18 Sep 2006 12:24:36 GMT
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());

This works fine accross most of the JDBC drivers I came across so far including 

Hope this helps


View raw message