当幸福来敲门

我就会牢牢抓住!
随笔 - 50, 文章 - 3, 评论 - 8, 引用 - 0
数据加载中……

大文本值CLOB取值 和 存值

存值
 Clob  organdetail =Hibernate.createClob(request.getParameter("organdetail").equals("")?"":request.getParameter("organdetail").trim());// 机构简介
   取值 显示JSP
<%=ToolsCommon.Clob2String(institutions.getOrgandetail())==null?"":ToolsCommon.Clob2String(institutions.getOrgandetail())%>


 public static String Clob2String(java.sql.Clob clob) {
  String s1 = "";
  char ac[] = new char[200];

  if (clob == null)
   return null;
  java.io.Reader reader = null;
  int i;
  try {
   reader = clob.getCharacterStream();
   while ((i = reader.read(ac, 0, 200)) != -1)
    s1 = s1 + new String(ac, 0, i);
  } catch (Exception exception1) {
   // throw new java.sql.SQLException(exception1.getMessage());
   System.out.println(exception1.toString());
  }

  finally {
   try {
    reader.close();
   } catch (Exception _ex) {
   }
  }
  return s1;

 }

posted on 2013-02-28 10:20 wyx 阅读(357) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航: