Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How do I retrieve the manipulated blob?

How do I retrieve the manipulated blob?

Scheduled Pinned Locked Moved Database
questiondatabasesql-servercomsysadmin
6 Posts 4 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lookilok
    wrote on last edited by
    #1

    Through the this content SQL Server - BLOB Import and Export[^] and How to store and fetch binary data into a file stream column[^] , I was able to retrieve the blob from the FileImage column. But it doesn't work for some records. In other words, it opens with an error for this type of file that has been fetched. Table structure:

    CREATE TABLE [dbo].[Attches](
    [AttchID] [int] IDENTITY(1,1) NOT NULL,
    [FileType] [varchar](30) NOT NULL,
    [FileSize] [int] NULL,
    [FileImage] [varbinary](max) NULL
    )

    I tried to extract a damaged document or pdf file in raw form and opened it with Hexinator software. All the file that is corrupted, first its hex starts with the path of the file. In other words, it is manipulated. Is there a way to retrieve data safely? Best regards

    J L 2 Replies Last reply
    0
    • L lookilok

      Through the this content SQL Server - BLOB Import and Export[^] and How to store and fetch binary data into a file stream column[^] , I was able to retrieve the blob from the FileImage column. But it doesn't work for some records. In other words, it opens with an error for this type of file that has been fetched. Table structure:

      CREATE TABLE [dbo].[Attches](
      [AttchID] [int] IDENTITY(1,1) NOT NULL,
      [FileType] [varchar](30) NOT NULL,
      [FileSize] [int] NULL,
      [FileImage] [varbinary](max) NULL
      )

      I tried to extract a damaged document or pdf file in raw form and opened it with Hexinator software. All the file that is corrupted, first its hex starts with the path of the file. In other words, it is manipulated. Is there a way to retrieve data safely? Best regards

      J Offline
      J Offline
      jschell
      wrote on last edited by
      #2

      lookilok wrote:

      But it doesn't work for some records

      As stated this is not a database problem. Potential causes. Could be others. - You are not reading the entire contents completely. It works for some because the process you are using accidently reads if fully to the end or the lost parts are not actually needed. - You succeed for some because you make assumptions about what it is or how it should be used. So nothing at all to do with the database. For example you assume that every one is a pdf when if fact some are word docs. There should be information in the database that tells you what the type is. - The data is in fact corrupted in the database. So a data issue and absolutely no way you can fix it in code.

      L L 2 Replies Last reply
      0
      • J jschell

        lookilok wrote:

        But it doesn't work for some records

        As stated this is not a database problem. Potential causes. Could be others. - You are not reading the entire contents completely. It works for some because the process you are using accidently reads if fully to the end or the lost parts are not actually needed. - You succeed for some because you make assumptions about what it is or how it should be used. So nothing at all to do with the database. For example you assume that every one is a pdf when if fact some are word docs. There should be information in the database that tells you what the type is. - The data is in fact corrupted in the database. So a data issue and absolutely no way you can fix it in code.

        L Offline
        L Offline
        lookilok
        wrote on last edited by
        #3

        If we assume that this record is encrypted or compressed, Is there a way to show how the records with this problem were encrypted? What encryption or compress method?

        J 1 Reply Last reply
        0
        • L lookilok

          If we assume that this record is encrypted or compressed, Is there a way to show how the records with this problem were encrypted? What encryption or compress method?

          J Offline
          J Offline
          jschell
          wrote on last edited by
          #4

          Some encryptions and some compressions might put a signature at the beginning of the file. If it exists it is not guaranteed to be unique but likely is sufficient to guess about it. You would need to research each possibility. For example... "Conventionally the first thing in a ZIP file is a ZIP entry, which can be identified easily by its local file header signature. However, this is not necessarily the case, as this is not required by the ZIP specification - most notably, a self-extracting archive will begin with an executable file header." ZIP (file format) - Wikipedia[^]

          1 Reply Last reply
          0
          • L lookilok

            Through the this content SQL Server - BLOB Import and Export[^] and How to store and fetch binary data into a file stream column[^] , I was able to retrieve the blob from the FileImage column. But it doesn't work for some records. In other words, it opens with an error for this type of file that has been fetched. Table structure:

            CREATE TABLE [dbo].[Attches](
            [AttchID] [int] IDENTITY(1,1) NOT NULL,
            [FileType] [varchar](30) NOT NULL,
            [FileSize] [int] NULL,
            [FileImage] [varbinary](max) NULL
            )

            I tried to extract a damaged document or pdf file in raw form and opened it with Hexinator software. All the file that is corrupted, first its hex starts with the path of the file. In other words, it is manipulated. Is there a way to retrieve data safely? Best regards

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            As long as you are reading and writing the files in binary mode there should not be any problems.

            1 Reply Last reply
            0
            • J jschell

              lookilok wrote:

              But it doesn't work for some records

              As stated this is not a database problem. Potential causes. Could be others. - You are not reading the entire contents completely. It works for some because the process you are using accidently reads if fully to the end or the lost parts are not actually needed. - You succeed for some because you make assumptions about what it is or how it should be used. So nothing at all to do with the database. For example you assume that every one is a pdf when if fact some are word docs. There should be information in the database that tells you what the type is. - The data is in fact corrupted in the database. So a data issue and absolutely no way you can fix it in code.

              L Offline
              L Offline
              lofty jeson
              wrote on last edited by
              #6

              On the Initiate Restore tab, choose Azure Blobs (Azure Storage) as the Datasource type and select the Backup Instance you want to restore. The backup instance is the storage account that contains the blobs you want to restore. On the Select recovery point tab, select the type of backup you want to restore.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups