0 Replies Latest reply on May 15, 2003 6:48 AM by 394698

    Facing Problem reading Long Raw field

    394698
      Hi All,

      I am facing problem while reading data from a Long Raw
      column using Oracle Object for OLE 8.1.7.3.15.


      Problem description:

      There is a column in the database table which stores
      the files into a column of datatype LONGRAW. I have
      read the file from
      the column and construct the bytes read as the file.
      To do this I am using oracle object for ole ver
      8.1.7.3.15
      (and Oracle database Server verion is 8.1.5). I used
      GetChunk method to construct file; below is the code
      snippet:

      --------------------------------------------------------------------------------------------------
      Public Sub PutDataFromFieldToFile(f As Object, Fname$)

      'f is the field object, Fname is name of the
      file to construct
      Dim fnum%, i As Long
      Dim CurSize As Integer, CurChunk As String
      Const ChunkSize = 32000

      fnum = FreeFile
      Open Fname For Binary Access Write As fnum
      i = 0
      'Loop through all of the chunks
      'Oracle does not return the size of columns >
      64KB.
      'We should loop until the length of our block is
      'less than we asked for.
      Do
      CurChunk = f.GetChunk(i * ChunkSize,
      ChunkSize)
      CurSize = Len(CurChunk) 'Get the length of the
      current chunk.
      Put #fnum, , CurChunk 'Write chunk to file.
      i = i + 1
      Loop Until CurSize > ChunkSize
      Close fnum
      End Sub

      --------------------------------------------------------------------------------------------------

      Above code is fetching the bytes from the specified
      field, but if we view the file, for example pdf, is
      not getting opened in its associated viewer and
      getting an error saying the file got corrupted.


      Please advice me how to solve the problem or let me
      know if there are any patches to be installed either
      at client side or server side.

      Further, the same code was working fine with OO4O
      8.1.7.3.11. But we dont want to go back to OO4O
      8.1.7.3.11 version.


      The database Server verion we are using is 8.1.5 and
      it is installed on Solaris OS.


      Please let me know if u want any further information.

      Thanks in advance
      Ram