1 Reply Latest reply on May 17, 2002 1:38 PM by asauve

    SpyMessage should implement BLOB

    asauve

      I cannot store messages to the Oracle database in any form, I tried using the variety of BLOBS (OBJECT_BLOB, BYTE_BLOB, and BINARYSTREAM_BLOB)... The BYTE_BLOB and BINARYSTREAM_BLOB both persist the message to the database but cannot retrieve the message from the database different IO exceptions are thrown for each... So I started to look into the code and I noticed and if you specify the OBJECT_BLOB that the setObject function call is used... This is the simplest way to store the object in the database, but the thing is that SpyMessage does not implement java.sql.BLOB interface, therefore a invalid column type is thrown... If SpyMessage would implement BLOB or at least java.sql.SQLDATA, the setObject function call should be supported by the various JDBC drivers and you could do away with the BYTE_BLOB and the BINARYSTREAM_BLOB... Well this is just my research but perhaps there is a reason that this is the way that it is, but I think to support better the variety of database that it would be easier to conform to the JDBC API then having to use a variety of BLOB types...

      Later,
      Alex

        • 1. Re: SpyMessage should implement BLOB
          asauve

          AH! I have a fix... The problem with the BINARYSTREAM_BLOB was that the ObjectOutputStream was not being flushed before the read from the ByteArrayOutputStream... Just do an oos.flush() after the writeMessage function call... Of course you cross one wall you will hit another, now the messages are not being deleted from the database and there is an XAException on SpyXAResource.commit()... Darn!!!

          Later,
          Alex