Reputation: 381
Dears, I have a problem reading the Excel data and loading it to DB which is more than 15000 rows as it is causing OutOfMemory error. It's a Java Swing application where there is one action to load the excel and another action is there to write complete data to DB.
Is it possible to read around 3000 records every time and load it to cache and then write it to DB without causing Memory Issue instead of loading 15k records at a time ? Anyone can help me?
Upvotes: 0
Views: 472
Reputation: 33
You can use org.apache.poi.xssf.eventusermodel.XSSFReader
.
This library uses SAX parser to read xlsx files, which is also very memory efficient.
Second option is to use excel-streaming-reader
. It contains cell information also. It also works perfectly if there are empty cells.
I have done using both methods.
Upvotes: 1