问题
I want to retrieve data stored in image
datatype of SQL Server. But when I invoke adapter all I get is
**PHOTO": "[B@62c2805a",**
According to this blog we need to get bytes from returned value and it may be java.sql.Blob a simple toString() on the object. https://www.ibm.com/developerworks/community/blogs/dhuyvett/entry/jsonstore_revisited_in_worklight_v6_part_1_the_adapter?lang=en
When I tried getting bytes, I got following error
Java class \"[B\" has no public instance field or method named \"getBytes\
So I just wanted to know if the image
data type is supported by adapters for SQL Server? If yes what is the correct approach of getting data?
I am using MFP 7.0 and I have checked DB. It has data as byte array.
回答1:
I am not sure about "getBytes". This is not related to MobileFirst adapters.
The suggested approach to working with images in your database is to encode the image into base64 and save the resulting string in the database. You can then send the encoded string to the client to be de-coded back into image form. There are several questions on this topic in Stack Overflow.
来源:https://stackoverflow.com/questions/34349179/how-to-use-adapters-to-retrieve-sql-server-image-datatype-value