# reading a blob field into a string as base64

**URL:** <https://forum.servoy.com/t/reading-a-blob-field-into-a-string-as-base64/9623>\
**Category:** Classic Servoy\
**Created:** [September 21, 2008, 9:09pm UTC](https://forum.servoy.com/t/reading-a-blob-field-into-a-string-as-base64/9623 "2008-09-21T21:09:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dpearce](https://avatars.discourse-cdn.com/v4/letter/d/e95f7d/32.png) [@dpearce](https://forum.servoy.com/u/dpearce)\
**Post date:** [September 21, 2008, 9:09pm UTC](https://forum.servoy.com/t/reading-a-blob-field-into-a-string-as-base64/9623/1 "2008-09-21T21:09:54Z")

</div>

Does anyone know if it is possible to read a MYSQL blob field into a script in servoy as Base64.

Its a long story, but i need to embed an image into an XML string as \<img src="data:image/jpg;base64,'+imagedataasbase64…

in order to send it to an external plugin to render it.

Because the plugin is using an external rendering engine then the servoy blobloader doesn’t work.

When you refer to a blob field, it obviously appears as an array rather than the actual string within the file.  
Saw this on the web, but cannot translate the second line:

BLOB b = (BLOB)r.getBlob(‘ICON’);//BLOB is oracle type not Blob  
byte base = b.getBytes();  
Strgin res = Base64.encode(base);

Does anyone know how this can be done?

Thanks

David

---

<div class="post-metadata">

**Author:** ![ROCLASI](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/roclasi/32/4371_2.png) [@ROCLASI](https://forum.servoy.com/u/ROCLASI)\
**Post date:** [September 22, 2008, 3:03am UTC](https://forum.servoy.com/t/reading-a-blob-field-into-a-string-as-base64/9623/2 "2008-09-22T03:03:04Z")

</div>

Hi David,

You can use IT2Be’s free Cryptor plugin to base64 encode/decode anything.  
Your code will look something like this:

```auto
var sBase64String = plugins.it2be_cryptor.Base64encode(BLOBdataProvider);

```

Hope this helps.
