Caveat: I am not an expert in this area, or any area for that matter.  ;-)

It sounds like you really need to "create" a com.ibm.db2.app.Blob right?
...and then "fill it in?"  After some poking around, it looks like
com.ibm.db2.app.Lob has a static method to create a new empty temporary
Blob.

Try this:
-----8<---------- cut here ----------8<----------------
tokenBlob = com.ibm.db2.app.Lob.newBlob();      // new Blob
OutputStream os = tokenBlob.getOutputStream();  // get stream to fill Blob
os.write(rs.getBytes("TokenUsedToUniquelyIdentifyRecord"));  // fill Blob
set(58, TokenBlob);

HTH.

-blair

  ___   _           Blair Wyman                  IBM Rochester
 ( /_)  /  _  ' _   (507)253-2891            blairw@xxxxxxxxxx
__/__)_/_<_/_/_/_'  Opinions expressed may not be those of IBM



                                                                           
             Ron_H_Java@xemaps                                             
             .com                                                          
             Sent by:                                                   To 
             java400-l-bounces         java400-l@xxxxxxxxxxxx              
             @midrange.com                                              cc 
                                                                           
                                                                   Subject 
             11/27/2006 03:34          Re: UDTF returning Binary column to 
             PM                        iSeries                             
                                                                           
                                                                           
             Please respond to                                             
             Java Programming                                              
             on and around the                                             
              iSeries / AS400                                              
             <java400-l@midran                                             
                  ge.com>                                                  
                                                                           
                                                                           




Thanks for the reply.

Have any ideas then how to convert or cast a byte[] to a Blob?
I've tried multiple ways but so far no luck and I don't think I want to go
from byte array to string to Blob.
http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/ad/r0008989.htm


Any ideas would be appreciated.

Thank You
Ron

Here's a snippet of my code:

import COM.ibm.db2.app.*;
import COM.ibm.db2.app.Blob;
import java.sql.*;
import java.math.BigDecimal;

  public void history(

    // input parameter(s)

    String              parmWhere,

    // output columns

        String          Transactioncode,
        String          OrderNumber,
        String          ItemNumber,
        String          Warehouse,
        Blob            TokenBlob)      // Have tried String

  throws Exception {

        byte [] TokenUsedToUniquelyIdentifyRecord;

String sql="SELECT " +
          "Transactioncode, " +
          "OrderNumber, " +
          "ItemNumber, " +
          "Warehouse, " +
          "TokenUsedToUniquelyIdentifyRecord, " +
  "FROM Inventory.dbo.Inventory_History " +
  (parmWhere.equals("")?"":"WHERE " + parmWhere);

// Read the SQL Server "binary" column as a byte array in Java then
convert or cast it to a DB2 Blob
// Type mismatch: Cannot convert from byte[] to a Blob
TokenBlob = rs.getBytes("TokenUsedToUniquelyIdentifyRecord");
 set(58, TokenBlob);




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.