CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Java

 View an Oracle Clob using java

Print topic Send  topic

Author Message
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
View profile  Send private message
negociant

Posts: 31
Posted: 08/29/2007, 5:44 AM

And what happens?
View profile  Send private message
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.
View profile  Send private message
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
View profile  Send private message
samelk

Posts: 35
Posted: 08/29/2007, 8:09 AM

Matheus,

Works great!! Thank you.

I really appreciate your help.

Sam
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.