我往CLOB字段中写入数据,如果数据中包含中文,则会变为乱码存入,该如何解决?另外,中文读取的又该怎么处理,谢谢。以下是写入CLOB字段的部分代码
// 以下将文本文件加载为一个流,写入数据库的CLOB字段,这里的catalog.txt文件中包含中文
File fileC = new File("d:\\catalog.txt");
int lenC = (int)fileC.length();
InputStream fisC = new FileInputStream(fileC);
String sql = "insert into book_picture_catalog(book_id, book_catalog)values(?,?)";
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setInt(1, 1);
pstmt.setAsciiStream(3, fisC, lenC); // CLOB类型
pstmt.execute();
conn.commit();读取CLOB字段的部分代码
// rs是读取数据的ResultSet对象
Clob catalog = rs.getClob(2);
InputStream isC = catalog.getAsciiStream();
BufferedReader br = new BufferedReader(new InputStreamReader(isC));
String line = null;
while ((line = br.readLine()) != null){
    System.out.println(line);
}
isC.close();