IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Problem in String data to CLOB data Conversion

  • 1.  Problem in String data to CLOB data Conversion

    Posted Tue December 26, 2006 01:25 PM

    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


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 2.  RE: Problem in String data to CLOB data Conversion

    Posted Tue December 26, 2006 07:08 PM

    Review this thread if it helps

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

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

    HTH,
    RMG


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 3.  RE: Problem in String data to CLOB data Conversion

    Posted Wed December 27, 2006 05:25 AM

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


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 4.  RE: Problem in String data to CLOB data Conversion

    Posted Wed December 27, 2006 07:25 AM

    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…


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB