Extract a file from database table and save to local disk

Hi all,
I have a database table which has a blob type column. My task is to retrieve it and save it in a directory. How can I convert those blob type entries to File (text files) type? Please give me some idea and advice.?@Aksh1yadav @ddpadil

Thanks,
Sreekanth.K

1 Like

hey @sreekanth

The BLOB may be very large and if you try to move/Write it consume a lot of system memory and that for sure will affect UiPath performance.

You can use BinaryRader, BinaryWriter which exists in System.IO namespace.

But if your data is short in length then you can use like below code:

Byte BLOBData = new Byte[0];

BLOBData = (Byte)(System.Byte);

String s = System.Text.Encoding.UTF8.GetString(BLOBData);

Write this string data into Text file.

if data is large as i mentioned before then get the data in chunks of memory.

Regards…!!
Aksh

1 Like

Hi,

I have downloaded a file and push that file into the database as a BLOB.
I want to read that BLOB and save as a file. How can I do it?

Regards,
Krishnakanth.K

1 Like

@aksh1yadav,Thankyou for the prompt reply.

How can i invoke that code,Can you provide a sample implementation.!
When I’m trying to implement it using assign activity I’m getting error.Data
when I’m using invoke code activity


Do we have any sql related database query to convert blobdata into file and so that I can directly upload the file whenever required

2 Likes

it would we great when someone can solve the problem

any luck with this topic? it would be great if someone can help! @Palaniyappan you are the master!