• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to wirte content into the Clob field using Tomcat connection pooling

 
ramesh gopi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I am facing a problem in writing content into the CLOB data type in Tomcat 4.1.24 server using the tomcat connection pooling.

The code snippet is:

Writer outstream = null;
try {
StringWriter sw = new StringWriter();
// Here tomcat using DelegatingResultSet from the commons-dbcp.jar
java.sql.Clob clob = n.getResultSet().getClob("policy_text");
Reader r = clob.getCharacterStream();
char [] cbuf = new char[2000000];
r.read(cbuf);
sw.write(cbuf);
outstream = sw;
} catch (Exception e) {
e.printStackTrace();
}
PrintWriter aPr = new PrintWriter(outstream);

After that i am using this PrintWriter object to write content into the CLOB by using the apr.println("Sample Text"). The whole process is happening fine but the content what i have written in the PrintWriter is not storing into the database.

Please suggest me what could be the problem.

Thanks
Gopi Ramesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic