Problem in String data to CLOB data Conversion

Hi All!

I am using webMethods 6.0.1 version i need to insert XMLData (morethan 4kb) value in DB Table as a CLOB data,so have written Java service likw this

IDataCursor datacursor =pipeline.getCursor();
String data=IDataUtil.getString(datacursor,“string”);
long l=0;
oracle.sql.CLOB clobdocument = null;
try
{
BufferedWriter br = new BufferedWriter(clobdocument.setCharacterStream(l));
StringReader strrd=new StringReader(data);
char aux;
do{
aux=(char)strrd.read();
br.write(aux);
}while(aux != -1);

}catch(Exception e)
{
throw new ServiceException (“Canot convert CLOB To String”+e.toString());
}
datacursor.insertAfter(“CLOBData”,clobdocument);
datacursor.destroy();

If i Run the java service by giving string data giving below error

Could not run ‘convertCLOB’.

java.lang.reflect.InvocationTargetException: oracle.sql.CLOB.setCharacterStream(J)Ljava/io/Writer;

Help me on my approach of Conversion,if my approach is wrong can suggest me to convert

Review this thread if it helps

[URL=“wmusers.com”]wmusers.com

Also use driverType=oci for handling clob objects to DB.

HTH,
RMG

My requirement is use Thin drivers not OCI Drivers,so provide me java service to convert String to CLOb Object

here i Decided to go for Javaservice for converting String to the CLOB Object

in Adapter service i thought to keep java.sql.CLOB as a inputType, map the output of javaservice to this adapter service filed

than i started java service below is java code for converting string to CLOB Object.

IDataCursor datacursor =pipeline.getCursor();
String data=IDataUtil.getString(datacursor,“string”);

long l=0;
oracle.sql.CLOB clobdocument=null;

try
{
//int in=clobdocument.setString(l,data);
Writer wr=clobdocument.setCharacterStream(l);
BufferedWriter br = new BufferedWriter(wr);
StringReader strrd=new StringReader(data);
char aux;
do{
aux=(char)strrd.read();
br.write(aux);
}while(aux != -1);

}catch(Exception e)
{
throw new ServiceException (“Canot convert CLOB To String”+e.toString());
}
datacursor.insertAfter(“CLOBData”,clobdocument);
datacursor.destroy();

if i run this service giving below Error

Could not run ‘convertCLOB’.

java.lang.reflect.InvocationTargetException: oracle.sql.CLOB.setCharacterStream(J)Ljava/io/Writer;

i think problem in javaservice is not instatiated the CLOB ,i canot instatitate the CLOb becuase it is an interface.

pls provide me suggestion to convert string(XML Data ) to CLOB Object…