webMethods

webMethods

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
  • 1.  Converting BLOB to string

    Posted Fri April 16, 2004 07:45 PM

    Hi,

    I need to convert BLOB data to a string. There is this BLOB data which is a combination of string and media files. I know we won’t be able to see media data as string. But at least I need to see the text part in the BLOB data. I have this java code to convert BLOB to a byte array and then I am using “bytesToString” service. But its not giving me the output as required. Output is displayed like 0 | 0 | |E || .

    IDataCursor idc = pipeline.getCursor();
    idc.first(“blob”);
    oracle.sql.BLOB blobObj = (oracle.sql.BLOB)idc.getValue();
    try {
    long length = blobObj.length();
    byte msg = blobObj.getBytes(1, (int)blobObj.length());
    idc.insertAfter(“bytes”, msg);
    } catch (Exception e){
    }

    Any ideas,

    Thanks,

    Pauly


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


  • 2.  RE: Converting BLOB to string

    Posted Fri April 16, 2004 08:29 PM

    BLOBs are binaries. To convert it to string you need to understand how it was created (format of the BOLB). For example, first 20 bytes may represent string, next 50 represents java object etc. Then get the first 20 bytes in a byte array and convert it to string.


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


  • 3.  RE: Converting BLOB to string

    Posted Fri April 16, 2004 10:39 PM

    Hi,

    Thanks for the prompt response. This data is inserted into database by JDE BF. You will not know how how many bytes represent string etc.

    Thanks,
    Pauly


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


  • 4.  RE: Converting BLOB to string

    Posted Fri April 16, 2004 11:24 PM

    I am afraid that is not possible. What you are trying to do is to write a viewer application with out knowing the file format.


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


  • 5.  RE: Converting BLOB to string

    Posted Mon December 27, 2004 06:44 AM

    Hi

    I have a similar problem, wherein i insert the BLOB data into database using the JDBC adapter and while retrieving the BLOB data from the database, i am facing problems while converting the same to string.

    Please let me know ur valuable suggestions.

    Thanks
    Rakesh


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


  • 6.  RE: Converting BLOB to string

    Posted Mon December 27, 2004 07:00 AM

    Hi again

    I would like to let you know that i am using wM 6.1.

    Thanks
    Rakesh


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


  • 7.  RE: Converting BLOB to string

    Posted Tue December 28, 2004 09:34 AM

    Hi

    If you are using BLOBs with Oracle, check out Google for Oracle java classes. There are a number of custom built classes to convert between Blobs & Strings. ([url=“http://download-east.oracle.com/otn_hosted_doc/jdeveloper/904preview/jdbc-javadoc/index.html”]http://download-east.oracle.com/otn_hosted_doc/jdeveloper/904preview/jdbc-javadoc/index.html[/url])

    As for the other question, why are you combining String & BLOB data in a BLOB?? Can you influence the way the data is stored?

    Chris


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


  • 8.  RE: Converting BLOB to string

    Posted Wed January 05, 2005 11:07 AM

    Hi

    Thanks for ur response.

    I am not combining string and BLOB data in a BLOB, i am just trying to convert the BLOB data into string using the JDBC adapter.

    Thanks
    Rakesh


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