ORACLE CLOB对象的读写
来源:互联网 发布:李嘉诚 知乎 编辑:程序博客网 时间:2024/05/17 22:55
public void insertUserInfo(String a, String c) throws Exception {
PreparedStatement pst = null;
ResultSet rs = null;
Connection con = null;
BufferedWriter outStream =null;
DrmSysManager drmmgr = DrmSysManager.getInstance();
DBPersistenceManager pm = drmmgr.getDBPersistenceManager("UNIEAP"); //获取数据库连接
try{con=pm.getConnection();
con.setAutoCommit(false);
GetRowID getId = new GetRowID();
String row_id = getId.getwoid("", "");
String sql = "insert into user7001(row_id,USER_NAME,USER_DATE,USER_SQL)"
+ "values('" + row_id + "','" + a + "',sysdate,empty_clob())";
pst=con.prepareStatement(sql);
pst.executeUpdate();
pst=con.prepareStatement("select user_sql from user7001 where row_ID='"
+ row_id + "' for update");
rs=pst.executeQuery();
if (rs.next()) {
//oracle.sql.CLOB clob = (oracle.sql.CLOB) rs.getClob("user_sql");
oracle.sql.CLOB clob=this.clobToWeblogicCLOB(rs.getClob("user_sql"));
//weblogic.jdbc.wrapper.Clob_oracle_sql_CLOB clob=(weblogic.jdbc.wrapper.Clob_oracle_sql_CLOB)rs.getClob("user_sql");
outStream=new BufferedWriter(clob
.getCharacterOutputStream());
// data是传入的字符串,定义:String data
outStream.write(c);
if(outStream!=null){
outStream.close();
}
con.commit();
}
}catch(Exception e){
con.rollback();
e.printStackTrace();
}finally{
//con.close();
}
}
public static oracle.sql.CLOB clobToWeblogicCLOB(Object in)
{
oracle.sql.CLOB clob=null;
if ("oracle.sql.CLOB".equals(in.getClass().getName())){
clob = (oracle.sql.CLOB)in;
}else if ("weblogic.jdbc.wrapper.Clob_oracle_sql_CLOB".equals(in.getClass().getName())){
Method method=null;
try {
method = in.getClass().getMethod("getVendorObj",new Class[]{});
}
catch (SecurityException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
catch (NoSuchMethodException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
clob = (oracle.sql.CLOB)method.invoke(in,null);
}
catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return clob;
}
- ORACLE CLOB对象的读写
- C#对Oracle Clob对象的读写
- hibernate+oracle+clob的读写
- ibatis读写oracle的clob字段
- Hibernate+Oracle+CLOB的读写问题
- 关于 Oracle Clob Blob 字段的读写
- python读写oracle的clob字段
- c++ 读写Oracle--Clob对象,注意数据编码长度
- ORACLE CLOB对象值的比较问题
- 读写Oracle CLOB字段实例
- java读写Oracle clob数据
- Hibernate+Oracle+CLOB 读写问题
- oracle lob clob字段读写
- jdbctemplate的读写clob
- PowerBuilder 读写Oracle CLOB 和BLOB的数据
- Oracle中BLOB和CLOB数据的读写
- JDBC操作Oracle CLOB对象
- Oracle操作大对象CLOB
- 名词解释:SSD硬盘
- IIS5.1配置PHP5.3.1详解
- USB 过程
- VS2005中 添加包含文件,lib文件
- 解决远程桌面无法全屏的方法
- ORACLE CLOB对象的读写
- google天气预报实现
- sql server拆分字符串
- 多重剪贴板
- C#实现控制台退出控制
- 根文件系统制作
- 查看占用指定端口号程序的PID
- google原址
- Common Oracle RDBMS Misconceptions Datafiles aren't written during backup mode