简体   繁体   中英

Best way to store base64 string in HANA Cloud Database? (HANA MDC<trial>)

​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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM