As the title states, what is the best way to store a base64 string on the HANA Cloud database? I've been using a BLOB column type to store them, but the OData of my database displays it as a SAP ODATA defined "edm.binary" value, and I can't seem to insert more images into the database from my iOS app due to that fact, as I cant find a way to convert a base64 string into binary value
1 Answers
Well, this is not really related to HANA in my opinion, but it is a more general database question. See Storing image in database directly or as base64 data?.
In general, you either store it base64 = string or you store it binary = blob. You should not mix it (both base64 and binary), because it is both reduntant and you have the worst out of both worlds (both difficult to represent it into a plain text representation and also larger size).
To answer your original question, I would strongly NOT recommend you to store a base64 in a blob. As base64 is a simple string, you can use either of the character types, based on how large you expect it to be. See Character String Types (smaller ones, most likely not a fit for your needs) and Large Object types. My recommendation would be to use CLOB (as base64 is ASCII and you don't need full-text search support for it.

- 5,127
- 2
- 17
- 34
-
Thanks for the clarification regarding LOBs! Ok so I've decided to use CLOB to store my base64 string, but my OData still treats it as a Edm.Binary value, is this behavior normal? – Lulmao Nov 09 '17 at 13:10