Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uploading data from excel file to database using java

I need to upload data in an excel sheet to the database using java.

The database will be oracle.

The excel sheet will be uploaded once in a month by a user using a web application (Spring MVC front end).

The excel sheet will be having thousands of records/rows e.g. around 15000 or more.

  1. What is the fastest way to upload this huge data in database? We are using simple JDBC (Spring's JDBC Template).
  2. How do we handle transaction sand errors as there can be errors while uploading data in which case the partly uploaded data will be useless?
  3. We need to able to notify the user of the error so that he can correct the excel sheet and try again?

Please help/

like image 381
ashishjmeshram Avatar asked Nov 05 '22 06:11

ashishjmeshram


1 Answers

You can use Apache POI - the Java API for Microsoft Documents for processing the file, and then use plain JDBC for inserting data into your database.

It would be fairly fast, and you can catch all exceptions to alert the user about errors.

like image 94
Rogach Avatar answered Nov 10 '22 05:11

Rogach