samelk
Posts: 35
|
Posted: 08/29/2007, 5:42 AM |
|
Hello,
Does anybody have a solution for viewing a clob field using jsp and CCS 3.2? All we are trying to do is select a clob field from the database and view it using a ccs report or grid.
Thanks,
Sam
|
|
|
negociant
Posts: 31
|
Posted: 08/29/2007, 5:44 AM |
|
And what happens?
|
|
|
samelk
Posts: 35
|
Posted: 08/29/2007, 5:50 AM |
|
If I set the field as Memo, it displays "oracle.sql.CLOB@xxxxxx" instead of the actual data.
|
|
|
matheus
Posts: 386
|
Posted: 08/29/2007, 6:42 AM |
|
I change class DbRow from Codecharge, to recover CLOB.
Method: public Object get(Object key)
public Object get(Object key) {
Object value = null;
if ( (key instanceof String) && useUpperCase ) {
value = super.get( ((String) key).toUpperCase() );
/**Begin Custom Change ****/
if (super.get(key) instanceof java.sql.Clob){
java.sql.Clob clob = (java.sql.Clob)super.get(key);
try{
java.io.InputStream is = clob.getAsciiStream();
byte[] buffer = new byte[4096];
java.io.OutputStream outputStream = new java.io.ByteArrayOutputStream();
while (true) {
int read = is.read(buffer);
if (read == -1) {
break;
}
outputStream.write(buffer, 0, read);
}
outputStream.close();
is.close();
value = outputStream.toString();
}catch(java.io.IOException io_ex){
com.codecharge.util.CCLogger.getInstance().error("IOException recover CLOB", io_ex);
}catch(java.sql.SQLException sql_ex){
com.codecharge.util.CCLogger.getInstance().error("SQLException recoverCLOB", sql_ex);
}
}
/**End Custom Change**/
} else {
value = super.get( key );
}
return value;
}
_________________
Matheus Trevizan
Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br |
|
|
samelk
Posts: 35
|
Posted: 08/29/2007, 8:09 AM |
|
Matheus,
Works great!! Thank you.
I really appreciate your help.
Sam
|
|
|
|