Page 1 of 2

How to store a image base64 from an image asset to sql server database field type CLOB?

Posted: Thu May 25, 2017 5:01 pm
by Bernie

I want to store an image captured with the phone cam in a SQL Server database.
Simply mapping the image asset to the SQL Server database filed does not do the trick.

Any suggestions are welcome.


How to store a image base64 from an image asset to sql server database field type CLOB?

Posted: Thu May 25, 2017 6:07 pm
by Bruce Stuart

Hi Bernie,

I could be wrong however I'm not sure that this would be any different than going to the Appery database.

What we always do one retrieving an image from the camera or any other source... Is to map it to two places... First... To the image on the UI and second to local storage.

Then... Upon updating the database or inserting a new record... We always retrieve the image from local storage as opposed to from the screen element...

Likely you've already tried that but just in case...

Happy Thursday,

Bruce


How to store a image base64 from an image asset to sql server database field type CLOB?

Posted: Thu May 25, 2017 6:22 pm
by Bernie

Bruce,

That is exactly what I did and this works fine when using the Appery database.
Doing the same with a SQL Server database does not work in my example though.
Thanks for the comment - sure that will be helpful to others one day.


How to store a image base64 from an image asset to sql server database field type CLOB?

Posted: Thu May 25, 2017 6:39 pm
by Bruce Stuart

Thanks for the quick reply... So during your update... Does your SQL server database respond with an error?


How to store a image base64 from an image asset to sql server database field type CLOB?

Posted: Thu May 25, 2017 7:26 pm
by Bruce Stuart

I.e. I Assume you have 'on error' JavaScript that captures the error and gives you adequate information to debug from a Chrome debugging session ....


How to store a image base64 from an image asset to sql server database field type CLOB?

Posted: Thu May 25, 2017 7:52 pm
by Bernie

When I test the API service with an image base64 string I get

{
"code": "AE009",
"message": "Connection reset",
"status": "BAD_REQUEST"
}


How to store a image base64 from an image asset to sql server database field type CLOB?

Posted: Thu May 25, 2017 8:05 pm
by Bernie

It seems to be a time out issue. I just tuned down the quality and the picture size of the camera and it worked. Any idea on where to jack up the time out?


How to store a image base64 from an image asset to sql server database field type CLOB?

Posted: Thu May 25, 2017 8:08 pm
by Bruce Stuart

In general... Timeouts on the Appery platform... Are controlled by your subscription level... The more you pay per month the longer your time out period is.

I guess the question is is there anyway to optimize your insert statement on your SQL Server database?

Alternatively... The question really becomes is the database timing out or is Appery's API express timing out?


How to store a image base64 from an image asset to sql server database field type CLOB?

Posted: Thu May 25, 2017 8:20 pm
by Bernie

Any suggestions from Appery.io in regards of shrinking an image base64 string prior to storing it in the database?


How to store a image base64 from an image asset to sql server database field type CLOB?

Posted: Fri May 26, 2017 8:20 am
by Serhii Kulibaba

Hello Bernie,

You are right, it might be a timeout issue. In that case you have to reduce a size of your image before send it to the server or improve the speed of your database server.