Re: INSERTINg a Clob in a portable way





Frank Meyer wrote on 15.08.2007 14:04:
Thomas Kellerer wrote:
File f = new File("sourcfile.txt");
Reader r = new InputStreamReader(new FileInputStream(f), "UTF-8");
preparedStatement.setCharacterStream(1, r, f.length());

Hi Thomas,

have a look at http://java.sun.com/mailers/techtips/corejava/2007/tt0207.html#1
where this issue may be clarified.

Hi Frank

thanks for the answer, but I don't understand the relation to my question.

If I understand the article correctly, it describes how I can remove (normalize) problematic characters from a String. But in my case I need to store the contents of a text file un-altered into a database CLOB field. But to do that I need to know the number of characters according to a given encoding in a file, without reading the file into memory.
I can't seem to get the relation to normalizing a text input here...


Thomas
.