08. september 2003 - 16:58Der er
7 kommentarer og 1 løsning
Java/Oracle CLOB i UFT-8 format
We have data in an Oracle CLOB column in UTF-8 format. We want to write this data into a text file by using a JAVA client and keep it in UTF-8 format. To write the data into the file is no problem but we loose the UTF-8 format. How should we do to keep the UTF-8 format? A code example to solve this would be great!
OracleResultSet orabatchResult = dbFacade.executeFetchXML(); while (orabatchResult.next()){ oracle.sql.CLOB clb = orabatchResult.getCLOB(1);
java.io.Reader reader = clb.getCharacterStream();
FileWriter fw=new FileWriter("test.xml"); int tmp; while ( (tmp=reader.read()) != -1 ) { // Write one character at a time to the file. fw.write( (char) tmp ); } fw.close(); }
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.