Skip to Content
0

Ajax throws "parsererror" & "SyntaxError: Unexpected end of JSON input" for Bulk Data Extract

Aug 02, 2017 at 12:08 PM

227

avatar image
Former Member

Dear All,

Good Day.!

Am facing an Issue with Ajax call to REST Web Service.

It all Works as Expected up to 50k number of Data Extract from DB. But more than 50k Ajax throws Error,

"Error:parsererror" & "Error:SyntaxError: Unexpected end of JSON input"

Also i see the Data reaches upto REST from DB,,,

Below is the piece of code being used for,

getTableRecords : function(tableName, pkInput){ sap.ui.core.BusyIndicator.show(0); $ .ajax( { url : "/com.***~databrowser~rest~web/rest/DataBrowser/TableRecords/" + tableName, type : "POST", data : JSON.stringify(pkInput), dataType : 'json', contentType : "application/json;charset=utf-8", success : function(response) { if (response != undefined && response.tableRows.length > 0) { console.log("INZ:"+response.tableRows.length);***Code*** }, error : function(XMLHttpRequest, textStatus, errorThrown) { sap.ui.commons.MessageBox.show( "Error while getting Rows from Table " + tableName, "ERROR"); console.log("INZ:Error:"+errorThrown); } }); },

Please let Me know if why the Request fails for particularly bulk data extract ? and how this could be handled ?

Regards,

Nagishetty

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Jamie Cawley
Aug 02, 2017 at 03:27 PM
0

Maybe your db is timing out the request. Is pagination or filtering an option, 50k is a lot of data?

Regards,

Jamie

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Dear Jamie,

Thanks' for your response.!

I don't think db is timing out, as i confirm that data is extracted form DB via EJB to REST, but not reaching to UI where Ajax fails.

Is Ajax timing out ? or any other possible reasons reasons for the failure ?

Please suggest.

Regards,

Nagishetty

0

Yes thats a possibility. There is a timeout property that can be used in ajax calls, but as I said above you may want to re-think your approach.

Regards,

Jamie

0
Sergio Guerrero Aug 03, 2017 at 10:52 AM
0

agree w Jamie - and this is pretty much the same answer for different platforms.. some alternative options would be to split your request if possible and get smaller chunks of data, however, the fundamental question would be.... do you really need that much data? and what are you doing w it on the application. a lot of end users say we need to see everything but often they do not understand what everything means - maybe you can suggest some filters, or a different load option such as odata which by default would make smaller request to service and bind to a table... if your scenario is to download data to a file, maybe even zip the file or consider a different method (ETL tool), scheduled file download, etc.

Share
10 |10000 characters needed characters left characters exceeded
Sergio Guerrero Aug 03, 2017 at 10:52 AM
0

agree w Jamie - and this is pretty much the same answer for different platforms.. some alternative options would be to split your request if possible and get smaller chunks of data, however, the fundamental question would be.... do you really need that much data? and what are you doing w it on the application. a lot of end users say we need to see everything but often they do not understand what everything means - maybe you can suggest some filters, or a different load option such as odata which by default would make smaller request to service and bind to a table... if your scenario is to download data to a file, maybe even zip the file or consider a different method (ETL tool), scheduled file download, etc.

Share
10 |10000 characters needed characters left characters exceeded