weblogic下写clob
Writer writer = null;
oracle.sql.CLOB clob = null;
Object obj = rs.getClob(1);
String clsname = rs.getClob(1).getClass().getName();
System.out.println("clsname:"+clsname);
if(clsname.equals("oracle.sql.CLOB")){
clob = (oracle.sql.CLOB) rs.getClob(1);
}else if(clsname.equals("weblogic.jdbc.wrapper.Clob_oracle_sql_CLOB")){
Method method = obj.getClass().getMethod("getVendorObj",new Class[]{});
clob = (oracle.sql.CLOB)method.invoke(obj);
}
报错:java.lang.ClassCastException: oracle.sql.CLOB --------------------编程问答-------------------- 这种错误网上找找吧,多的很。 --------------------编程问答-------------------- 我把上面的代码改了一下,测试了一下也没问题,问题是我不知道这么写是什么意思求指导啊,说说重哪里入手也好。一下是修改后的代码。
Writer writer = null;
Object obj = rs.getClob(1);
String clsname = rs.getClob(1).getClass().getName();
Class clazz = obj.getClass();
java.lang.reflect.Method method = method = clazz.getMethod("getCharacterOutputStream", new Class[]{});
writer = (Writer)method.invoke(obj, new Object[]{});
writer.write(content);
writer.flush();
writer.close();
conn.commit(); --------------------编程问答-------------------- 我把上面的代码改了一下,测试了一下也没问题,问题是我不知道这么写是什么意思求指导啊,说说重哪里入手也好。一下是修改后的代码。
--------------------编程问答--------------------
Writer writer = null;
Object obj = rs.getClob(1);
String clsname = rs.getClob(1).getClass().getName();
Class clazz = obj.getClass();
java.lang.reflect.Method method = method = clazz.getMethod("getCharacterOutputStream", new Class[]{});
writer = (Writer)method.invoke(obj, new Object[]{});
writer.write(content);
writer.flush();
writer.close();
conn.commit();
我在网上找了好多了,唉,基础不扎实。
补充:Java , Web 开发