I've been facing the same issues with files. Java also needs to know the encoding of the file it is reading before you can read from it. Which means you are probably reading the file using a different encoding and inserting wrong data into the database.
This is part of my test code. Maybe it can be of some help.
Code:
File file = new File("myfile.txt");
RandomAccessFile raf = new RandomAccessFile(file, "rw");
FileInputStream fis = new FileInputStream(file);
FileChannel fc = raf.getChannel();
MappedByteBuffer mBuf;
CharBuffer cb;
CharsetDecoder decoder = Charset.forName("ISO8859_15").newDecoder();
try{
if(fc.isOpen()){
mBuf = fc.map(FileChannel.MapMode.READ_WRITE, 0, fc.size());
ByteBuffer bb = encoder.encode(decoder.decode(mBuf));
//do the reading
...
}
}
If anyone has a better solution, its more than welcome for me as well! ;o)