Oracle 查询数据

2014-11-24 19:01:02 · 作者: · 浏览: 31

CLOB fztdjqs = null;
PrintWriter fztdjqsOut=response.getWriter();
try {
s = myConnection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
r = s.executeQuery("SELECT * FROM TAB_FZTDJQS where xzcbm="+bianMa);

while (r.next()) {
fztdjqs=(CLOB) r.getClob("FZTD");
System.out.println(fztdjqs.toString());
}

} catch (SQLException e) {
e.printStackTrace();
}


public String ClobToString(CLOB clob) throws SQLException, IOException {
String reString = "";
Reader is = clob.getCharacterStream();// 得到流
BufferedReader br = new BufferedReader(is);
String s = br.readLine();
StringBuffer sb = new StringBuffer();
while (s != null) {// 执行循环将字符串全部取出付值给StringBuffer由StringBuffer转成STRING
sb.append(s);
s = br.readLine();
}
reString = sb.toString();
return reString;
}