cancel
Showing results for 
Search instead for 
Did you mean: 

Update Database tables through Java servlet using UI5 File Uploader

sunil_khemchand2
Participant
0 Kudos

Hi,

I am trying to insert data into database tables using excel file, for which I am using UI5 File Uploader, and calling Java Servlet in the backend. My requirement is to capture all the logs(which DB entries were updated, which failed, etc), and display this on UI.

My issue is I am unable to read this information, because the UploadComplete event of file uploader is getting triggered even before the file processing is complete in the backend.

Do you know if there is any other way to handle this? Any help/suggestions highly appreciated.

Thanks

Accepted Solutions (0)

Answers (4)

Answers (4)

sunil_khemchand2
Participant
0 Kudos

Hi Vaibhav,

Thanks for your response.

Yes, your understanding is correct. I am sending the excel to back-end for further processing. I was also thinking about the issue with temporary file, but don't see any other option. Will give that a try.

Thanks and Best Regards,

Sunil

mvaibhav
Contributor
0 Kudos

Hi Sunil,

If i have understood properly, you are sending the excel file to the back-end, reading the data from the excel file in back-end and updating the database based on the excel data.

Upload collection is used for just sending the documents to the back-end and it will not wait for the system to process the file to send the response.

In order to achieve your requirement, you should read the data from the excel file on the client side and send the data to the back-end to get & display required response.

Other way round could be to store the response in a temporary table and make a separate call from the UI once the upload collection returns successfully to fetch the output and display. However second option might lead to issues if you back-end takes considerable time to update and populate the temporary table.

Thanks,

Vaibhav Maheshwari

sunil_khemchand2
Participant
0 Kudos

Hi Mahesh,

I am uisng a Java Servlet, not Odata service.

Regards,

Sunil

maheshpalavalli
Active Contributor
0 Kudos

Then are you calling the java servlet manually to update the excel file to db?

maheshpalavalli
Active Contributor
0 Kudos

Hi Sunil,

The documentation says otherwise:

uploadComplete

Event is fired as soon as the upload request is completed (either successful or unsuccessful). To see if the upload request was successful, check the 'state' parameter for a value 2xx. The uploads actual progress can be retrieved via the 'uploadProgress' Event. However this covers only the client side of the Upload process and does not give any success status from the server.

It seems that it is only for the client side upload.

If you are using the odata service, there are two events:

requestCompleted and batchRequestCompleted maybe use them and check your handler for those event gets called.

BR,

Mahesh

sunil_khemchand2
Participant
0 Kudos

Hi Mahesh, I am calling the servlet from the upload button itself

maheshpalavalli
Active Contributor
0 Kudos

Then if you call the servlet will it return any response function call when it is successful(for asynchronous)? If synchronous, then immediatly after that call the servlet again to fetch the db log data.

BR,

Mahesh