<%@ page contentType="text/html; charset=gb2312" %>
<%@ page info="database handler"%>
<%@ page import="java.io.*"%>
<%@ page import="java.net.*"%>
< " /> 日本三级亚洲精品,婷婷电影在线观看,91久久精品无嫩草影院

色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

jsp讀取大對(duì)象CLOB并生成xml文件示例


<%@ page contentType="text/html; charset=gb2312" %>
<%@ page info="database handler"%>
<%@ page import="Java.io.*"%>
<%@ page import="Java.NET.*"%>
<%@ page import="Java.lang.*"%>
<%@ page import="Java.util.*"%>
<%@ page import="Java.sql.*"%>
<%@ page import="Javax.servlet.*"%>
<%@ page import="Javax.servlet.http.*"%>
<%@ page import="oracle.sql.CLOB"%>
<%@ page import="oracle.jdbc.driver.OracleResultSet"%>

<html>
<head>
<meta content="text/html; charset=gb2312" http-equiv="content-type">
</head>
<body>
<%
int i=0;
String parID = request.getParameter("id_no");
String strSql;
String content="";

try{
String xmlFile = "/usr/local/tomcat/webapps/vehicles/test.xml";

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String dburl="jdbc:oracle:thin:@192.168.15.250:1521:ycdb";
Connection con=DriverManager.getConnection(dburl,"training","deep1704sea");
Statement stmt=con.createStatement();

//使用流讀取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ù)庫(kù)中讀出的內(nèi)容寫到文件中
FileOutputStream fo = new FileOutputStream(xmlFile);
PrintStream so = new PrintStream(fo);
so.println(content);
so.close();

rs.close();
stmt.close();
con.close();

}catch(Exception e){
out.println(e);
}
%>
</body>
</html>

jsp技術(shù)jsp讀取大對(duì)象CLOB并生成xml文件示例,轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 宜都市| 虞城县| 邵阳县| 江孜县| 临夏市| 云阳县| 枞阳县| 宁波市| 商水县| 团风县| 南皮县| 河北省| 禹城市| 东乡| 锡林郭勒盟| 岳阳市| 民勤县| 廉江市| 集安市| 德昌县| 遂溪县| 赤水市| 邵阳县| 安仁县| 高陵县| 武鸣县| 明溪县| 蚌埠市| 武夷山市| 丽水市| 航空| 永寿县| 淳安县| 商洛市| 云和县| 慈溪市| 沅陵县| 浪卡子县| 新邵县| 西昌市| 张家口市|