Extract a file from database table and save to local disk


#1

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


Read BLOB from database
#2

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


#3

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


#4

@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