TBlobStream data, read from .NET

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
matejgolob
Posts: 1
Joined: Mon 24 Dec 2018 11:06

TBlobStream data, read from .NET

Post by matejgolob » Mon 24 Dec 2018 11:13

I have some database data written with Unidac component (from Delphi). In MSSQL table (varbinary field) I have stored some "xml files" (using TBlobStream).
Now I want to read that data from .NET code. But it looks that data in field is somewhat compressed. If I read data from .NET as byte array, and save data to file, text is started with:
PKZ#900Z...

So question is. Is there any way to read/decode/decompress that data (stored with Unidac) from .NET?

DrPsyche
Posts: 2
Joined: Wed 30 Jan 2019 07:28

Re: TBlobStream data, read from .NET

Post by DrPsyche » Wed 30 Jan 2019 07:43

matejgolob wrote:
Mon 24 Dec 2018 11:13

Re: TBlobStream data, read from .NET


I have some database data written with Unidac component (from Delphi). In MSSQL table (varbinary field) I have stored some "xml files" (using TBlobStream).
Now I want to read that data from .NET code. But it looks that data in field is somewhat compressed. If I read data from .NET as byte array, and save data to file, text is started with:
PKZ#900Z...

So question is. Is there any way to read/decode/decompress that data (stored with Unidac) from .NET?


Hi matejgolob,

Have you tried to disable compression?
I tried to use the GZIP algorithm (in SQL Server 2016). Anyway, you will need to create a table for decompressed data storage.

Cheers,
Steve

Stellar
Devart Team
Posts: 305
Joined: Tue 03 Oct 2017 11:00

Re: TBlobStream data, read from .NET

Post by Stellar » Tue 05 Feb 2019 15:20

By default, UniDAC does not perform compression for saving values of the BLOB fields. UniDAC utilizes the Zlib library for data compression. Please try saving values of the BLOB field without compression with UniDAC and then read this value in .NET.
To prevent TUniQuery/TUniTable from saving values of the BLOB fields in the compressed form on the server, set the CompressBlobMode option to cbNone, for example:

Code: Select all

uses
  MemData;

...

UniQuery1.Options.CompressBlobMode := cbNone; 
Learn more about the CompressBlobMode option:
https://www.devart.com/unidac/docs/deva ... obmode.htm

Post Reply