//使用流讀取CLOB或BLOB列 strSql = "select xmlgen.getxml('select * from account_holder where id_no=''0001''') from dual "; ResultSet rs=stmt.executeQuery(strSql); if(rs.next()){ CLOB clob = ((OracleResultSet)rs).getCLOB(1); if(clob!=null){ Reader is = clob.getCharacterStream(); BufferedReader br = new BufferedReader(is); String s = br.readLine(); while(s!=null){ //byte[] temp = s.getBytes("iso-8859-1"); //s = new String(temp); content += s; s=br.readLine(); } } } //out.println(content);
//將從數(shù)據(jù)庫中讀出的內容寫到文件中 FileOutputStream fo = new FileOutputStream(xmlFile); PrintStream so = new PrintStream(fo); so.println(content); so.close();