Clob clob=null;
if(rs.next())
{
clob = rs.getClob(1);//ResultSet rs
try{
if(clob!=null)
{
int len=(int)clob.length();
char[] content=new char[len];
int success=clob.getCharacterStream().read(content);//读取clob内容
return new String(content,"GBK");//返回clob的内容
}
}//catch(SQLException e){}
catch(IOException e){}
}
if(rs.next())
{
clob = rs.getClob(1);//ResultSet rs
try{
if(clob!=null)
{
int len=(int)clob.length();
char[] content=new char[len];
int success=clob.getCharacterStream().read(content);//读取clob内容
return new String(content,"GBK");//返回clob的内容
}
}//catch(SQLException e){}
catch(IOException e){}
}
EJB应该不是这可望而不可及处理的啊
CMP Ejb: /**
*
*/
public abstract void setAppendix(byte[] appendix);
/**
* @ejb:persistent-field
* @ejb:jdbc-type JAVA_OBJECT
* @ejb:sql-type BLOB
* @ejb:interface-method
*/
public abstract byte[] getAppendix();
测试没有成功
平台:
WIN2000
oracle8.1.7
resin-ee-2.1.6保存到数据库中后,读出来的值不对!
2. Edit the XML by declaring the dbms-column-type deployment descriptor in the weblogic-cmp-rdbms jar.xml file.
<field-map>
<cmp-field>description</cmp-field>
<dbms-column>product_description</dbms-column>
<dbms_column-type>OracleClob</dbms-column-type></field-map>
xml文件的例子见上面,在EJB中的方法声明用setDescription(String s),不要用setDescription(Clob c).