繁体中文
设为首页
加入收藏
当前位置:JSP技术首页 >> 数据库相关 >> weblogic下写clob的方法

weblogic下写clob的方法

2004-10-01 08:26:10  作者:  来源:互联网  浏览次数:38  文字大小:【】【】【
简介:写CLOB的代码片段: String SqlStr = "update TextInfo set Content=empty_clob() where TextInfoKey=" + Integer.toString(textinfokey); myConn.setAutoCommit(false); java.sql...
关键字:weblogic 方法 clob

写CLOB的代码片段:

String SqlStr = "update TextInfo set Content=empty_clob() where TextInfoKey=" + Integer.toString(textinfokey);

myConn.setAutoCommit(false);

java.sql.PreparedStatement pstmt = myConn.prepareStatement(SqlStr);

pstmt.executeUpdate();

SqlStr = "select Content from TextInfo where TextInfoKey=" + Integer.toString(textinfokey) + " for update";

java.sql.Statement st = myConn.createStatement();

java.sql.ResultSet rs = st.executeQuery(SqlStr);

java.sql.Clob clob ;

if (rs.next()) {

clob = rs.getClob("Content");

weblogic.jdbc.rmi.SerialOracleClob cast1 =(weblogic.jdbc.rmi.SerialOracleClob)clob;

weblogic.jdbc.rmi.internal.OracleTClobImpl cast2 =(weblogic.jdbc.rmi.internal.OracleTClobImpl)cast1.getTheRealClob();

CLOB myClob = (oracle.sql.CLOB)cast2.getTheRealClob();

java.io.Writer out=myClob.getCharacterOutputStream();

out.write(content);

out.flush();

out.close();

}

责任编辑:admin
相关文章